JSON Duplicate Keys

gaz Heyes gazheyes at gmail.com
Thu Jun 6 05:00:55 PDT 2013


On 6 June 2013 12:29, Douglas Crockford <douglas at crockford.com> wrote:

> The JSON RFC says
>
>     The names within an object SHOULD be unique.
>
> Sadly, there are people in the JavaScript community who interpreted SHOULD
> to mean DON'T HAVE TO. In a perfect world, we would change the SHOULD to
> MUST, but we can't. Interoperability and security concerns demand that we
> specify what happens when keys are duplicated. So we may end up with
> something like this:
>
>     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.
>
> Does anyone see a problem with this?
>

 That doesn't make sense "should" should be "must" because if it's taking
the last key then you can overwrite someone else's data.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130606/5ef8966c/attachment.html>


More information about the es-discuss mailing list