Re: [Json] Go JSON parser ignores the case of member names

Rob Sayre <> Thu, 10 March 2016 02:01 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 9396F12DCE2 for <>; Wed, 9 Mar 2016 18:01:07 -0800 (PST)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2.699
X-Spam-Status: No, score=-2.699 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: (amavisd-new); dkim=pass (2048-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id svA3_RGjzEma for <>; Wed, 9 Mar 2016 18:01:03 -0800 (PST)
Received: from ( [IPv6:2607:f8b0:4001:c06::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id F06B812DADF for <>; Wed, 9 Mar 2016 18:01:02 -0800 (PST)
Received: by with SMTP id m184so89418016iof.1 for <>; Wed, 09 Mar 2016 18:01:02 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=P7dmHkH1IAXFMBuVwTa5dPRVUetfYCIO3MeJkOyPMIE=; b=L0XX7xBh70W1vi5GXsq4YlFuyx3LQxQqqEFwUUy49nFf6mDCe5gDF0Iel3wts1x7m7 OsgfiXht0qL7W1Okih8QWmx0dI9UIlYPELTpoJ5985BS009Q3cK5oLhZ8hjZMfRSaSm4 tSK71TRI0NDPPp6RL5ZF6noNs2fPs4c4Alx1C+KDtty4KDIjHzZkQj0HHFV/p5xU2Opl 2aUC9dCvy1Fbt+YB85DPIhRDpgVbShOTmhiCi4rQtkUFdVadOlfxr86WqjpYrFMwmSo+ InYrp7l4Y7gDqykQ8chvCtbCSirTtPgcSlVWEb9KRswi9/dnMo2dmT3TjcQY4kbN5fZr hoyA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=P7dmHkH1IAXFMBuVwTa5dPRVUetfYCIO3MeJkOyPMIE=; b=mrNTZYoy54VZwkNUcmiA/xnmZYfk3IjEk6mKAs2cD+Jbiby4ogX4gWa0Bm7UPm0FUR AD10zaNTGrY6n8R5Q2bOlf4Oadmgunn7WUMyY5+lh0xtAV//KTcQZomwsggy6Vy4GTC9 chBIyVMDb7tmMJNraYVI2/V+LQDNOsc2jD223/bYHG6hpMlPFHgT6QplqVeRMoIbjZa/ 42yqUqmdXjspb7C5J6fNQ0VCCA1Eu6+pXJy1BRz5rRUkEZxv4uh3fLukYgESSooJ5QLr TSeCJAfDbxCdzz1W86XOa3tkR0kC0BlQIrH1jx0OyDXFPaP/Q5bd7gqIrqUEsiikW5fA LNlA==
X-Gm-Message-State: AD7BkJK3A0kdZK5QmpSL/7dXMMfyICI0X+UV+bScVz54MsiPwSF/HItAI0J/HscILZ35azBNr1s02xMU0O5Q8Q==
MIME-Version: 1.0
X-Received: by with SMTP id d42mr965377ioj.80.1457575262101; Wed, 09 Mar 2016 18:01:02 -0800 (PST)
Received: by with HTTP; Wed, 9 Mar 2016 18:01:02 -0800 (PST)
In-Reply-To: <>
References: <> <> <> <>
Date: Wed, 9 Mar 2016 18:01:02 -0800
Message-ID: <>
From: Rob Sayre <>
To: John Cowan <>
Content-Type: multipart/alternative; boundary=001a114217dcbb29b5052da82fea
Archived-At: <>
Cc: "Manger, James" <>, "" <>
Subject: Re: [Json] Go JSON parser ignores the case of member names
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Thu, 10 Mar 2016 02:01:07 -0000

On Wed, Mar 9, 2016 at 1:38 PM, John Cowan <> wrote:

> Rob Sayre scripsit:
> > Well, there are ways to avoid it too (see below). I see it more as an
> > object-mapper convenience than a JSON conformance problem. I imagine
> object
> > mapping libraries in other languages have this feature too.
> The problem arises in cases like this: Suppose the spec says that key
> "alg" specifies the name of the algorithm, and defaults to "none" if
> there is no key.  Then if the upstream provider sends {"typ" : "JWS",
> "ALG": "HS256"}, then a receiver written in Go will see the algorithm
> as HS256, whereas any other receiver will see the algorithm as "none".
> That's almost certainly not the desired result.

I understand the situation. I guess I don't agree there's a conformance
problem here, since there are plenty of other APIs in the standard package
that don't do this transformation, and even the API in question doesn't do
this transformation for all arguments. They're right below the section
James quoted.

BTW, here's how to get a similar effect using the widely-used Java library

ObjectMapper objectMapper = new ObjectMapper();

- Rob


> --
> John Cowan
> To say that Bilbo's breath was taken away is no description at all.  There
> are
> no words left to express his staggerment, since Men changed the language
> that
> they learned of elves in the days when all the world was wonderful. --The
> Hobbit