JSON Duplicate Keys
allen at wirfs-brock.com
Thu Jun 6 08:27:56 PDT 2013
On Jun 6, 2013, at 6:46 AM, Rick Waldron wrote:
> On Thu, Jun 6, 2013 at 7:29 AM, Douglas Crockford <douglas at crockford.com> wrote:
> The JSON RFC says
> The names within an object SHOULD be unique.
> The names within an object SHOULD be unique. If a key is duplicated,
> a parser SHOULD reject. If it does not reject, it MUST take only the
> last of the duplicated key pairs.
> As far as I can tell, this is the de facto browser behavior.
I'm not sure what you mean by this. The ES5 spec. for JSON.parse requires (ie MUST accept) that duplicate keys are accepted and that the value associated with the last duplicated key wins. A valid implementation of JSON.parse MUST not reject such JSON strings.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss