Re: [Json] The names within an object SHOULD be unique.

Vinny A <jsontest@yahoo.com> Fri, 07 June 2013 18:24 UTC

Return-Path: <jsontest@yahoo.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id C223C21F96ED for <json@ietfa.amsl.com>; Fri, 7 Jun 2013 11:24:14 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.119
X-Spam-Level:
X-Spam-Status: No, score=-0.119 tagged_above=-999 required=5 tests=[AWL=1.083, BAYES_00=-2.599, HTML_MESSAGE=0.001, MIME_QP_LONG_LINE=1.396]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NvKs6C-H0rej for <json@ietfa.amsl.com>; Fri, 7 Jun 2013 11:24:09 -0700 (PDT)
Received: from nm29-vm1.bullet.mail.bf1.yahoo.com (nm29-vm1.bullet.mail.bf1.yahoo.com [98.139.213.144]) by ietfa.amsl.com (Postfix) with ESMTP id DC68321F96EC for <json@ietf.org>; Fri, 7 Jun 2013 11:24:08 -0700 (PDT)
Received: from [98.139.212.150] by nm29.bullet.mail.bf1.yahoo.com with NNFMP; 07 Jun 2013 18:24:08 -0000
Received: from [98.139.211.202] by tm7.bullet.mail.bf1.yahoo.com with NNFMP; 07 Jun 2013 18:24:08 -0000
Received: from [127.0.0.1] by smtp211.mail.bf1.yahoo.com with NNFMP; 07 Jun 2013 18:24:08 -0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1370629448; bh=FoyphOlYJaXZp2SkoxHDjQUqT7WG0di8Y56vQPVRFbI=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Subject:References:Cc:From:Content-Type:In-Reply-To:Message-Id:Date:To:Content-Transfer-Encoding:Mime-Version:X-Mailer; b=3wcjol6HFsmyWXLi5Dbc3kDLtreygZx96SG0Q19ZGUDvHf7YOr0BU4pts/jqZ+b2bOPMGbkKFPrJXOvFcgwA8KOy+mSRr6mH5D7iXXTVAdK8raadeuA1WCG0NXJP6WWzwiiy+dOfs6SppHRlOgzndqQWAzExkCpfuS1jc6HzgEQ=
X-Yahoo-Newman-Id: 203158.22713.bm@smtp211.mail.bf1.yahoo.com
X-Yahoo-Newman-Property: ymail-3
X-YMail-OSG: HHbGYvMVM1k_kpxiXYSiiDPsTkH7zSoZ.UEJN.MHUgegDce CGlXjoutq14UJ.GVETWA2lsjQkxJQdHmAWoqurNi3Yf0kBFfl93.z20ndRQG _QFBZ9hdWs9UEm0iBAYI_1xju_MVuv5wojFSXLviDtWnQRo.fWKpvc.J5VFf 8ewKARPulhROShSydzXnU3Ly6eApMmnLwB81WYZuSRbvMYQnLcIJqBjOah_0 gU9dCFfETDlCa4HiRfHqw5GSwgVCa_CZIABARhDUB0sEsl.U.RYr7e30el7u G_LsBBQ2sftm8tpCOySAYAr..zleYV2wDoEuLVm73Ep_e8_aZztSnMoztAXB edwtQt5JQMHUNqTTX0L1J2XSdhqy8maZYvQpB7sKpyvKm.gMZKnHL81Xp8ja 6ATwOElYNLLo2pxjrHChgHF3w4JMya_VqMn9.stcjwTknss2fKkPGWpLeNJB _sa_ITL6Nzmd_7XIZPVHrr2S9EUh3Jn9i9TFPJ1_s_y6W84ZtpkGtx0cRflX 3ndAHuoGaxWCz6yh6Nm_NQTtsgg--
X-Yahoo-SMTP: indQcmSswBC8IKsm6t4aCAPskK3T
X-Rocket-Received: from [192.168.10.95] (jsontest@64.134.39.87 with ) by smtp211.mail.bf1.yahoo.com with SMTP; 07 Jun 2013 11:24:08 -0700 PDT
References: <51AF8479.5080002@crockford.com> <51AF9ACF.5020507@cisco.com> <D0A99569-0915-4862-A7AE-9DE51C2E90C0@yahoo.com> <51AFB3F8.8060708@crockford.com> <8F32953C-C788-4DC9-888E-920E2BEB7FDD@yahoo.com> <831B8E46-F239-4353-8F95-8DF3F9BD2E78@yahoo.com> <51AFC924.2030805@crockford.com> <DA7A83A2-1C1F-4E74-BF6A-DA943B07AB59@vpnc.org> <C25B2BF6-512F-41CB-A9E8-E329E9C4BDCE@wirfs-brock.com>
From: Vinny A <jsontest@yahoo.com>
Content-Type: multipart/alternative; boundary="Apple-Mail-CD366FD4-314A-4C09-80B3-8E75969346C4"
In-Reply-To: <C25B2BF6-512F-41CB-A9E8-E329E9C4BDCE@wirfs-brock.com>
Message-Id: <8E679529-8663-4552-A905-529E732AEB7B@yahoo.com>
Date: Fri, 07 Jun 2013 12:43:15 -0500
To: Allen Wirfs-Brock <allen@wirfs-brock.com>
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (1.0)
X-Mailer: iPod Mail (9B206)
Cc: Paul Hoffman <paul.hoffman@vpnc.org>, "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] The names within an object SHOULD be unique.
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/json>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 07 Jun 2013 18:24:15 -0000


On Jun 6, 2013, at 12:45 PM, Allen Wirfs-Brock <allen@wirfs-brock.com> wrote:
> Allen Wirfs-Brock
> ECMAScript Language Spec. Project Editor

> What I would say, as a replacement for the current text  <section 2.2> is:
> 
>         The names within an object SHOULD be unique.  If a key is duplicated, a parser MUST take  <<use?? interpret??>> only the last of the duplicated key pairs.

Just to be clear here, ECMA is OK with using MUST in regards to the last key pair?  

Because we already have proposed language that says that, but one of the points under contention on this list is what to do with duplicated key pairs.

Is the following language acceptable to ECMA (disclaimer: original text by Paul,  modifications by me):


On Jun 6, 2013, at 10:24 AM, Paul Hoffman <paul.hoffman@vpnc.org> wrote:
> The new text should use language that is already in RFC 4627; "key" is not such a word. To be fair to implementers, the new document also needs to deal with both emitters and parsers.
> 
> Proposal:
> 
> In Section 2.2:
> Current:
>   The names within an object SHOULD be unique.
> Proposed:
>   If the names within an object are not unique, the result of parsing the 
>   object is unpredictable, and the parse may even fail completely. Thus,
>   the names within an object SHOULD be unique.
> 
> In Section 4, add a new paragraph:
>   If a parser encounters an object with duplicate names, the parser MAY
>   fail to parse the JSON text; if the parser accepts objects with duplicate
>   names, it SHOULD accept only the last name/value pair that has the
>   duplicate name. 

If we have to recommend to both parsers and emitters, I'd like to make a slight change to your wording:

In Section 2.2:
Current:
    The names within an object SHOULD be unique.
Proposed:
   The names within an object SHOULD be unique. Non-unique names have unpredictable effects (refer to sections 4 & 5).

In Section 4 (Parsers) add a new paragraph:
  If a parser encounters an object with duplicate names, the parser MAY fail to parse the JSON text; if the parser accepts objects with duplicate names, it MUST accept only the last name/value pair that has the duplicate name. 

In Section 5 (Generators) add a new paragraph:
   A JSON generator SHOULD not duplicate names. If duplicate names are generated, the authoritative name/value pair MUST be listed last.


-----------------
Vinny
www.jsontest.com