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

Douglas Crockford <douglas@crockford.com> Wed, 05 June 2013 23:27 UTC

Return-Path: <douglas@crockford.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 B198321E8054 for <json@ietfa.amsl.com>; Wed, 5 Jun 2013 16:27:29 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.278
X-Spam-Level:
X-Spam-Status: No, score=-2.278 tagged_above=-999 required=5 tests=[AWL=-0.279, BAYES_00=-2.599, J_CHICKENPOX_35=0.6]
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 mf4l+pURtIGk for <json@ietfa.amsl.com>; Wed, 5 Jun 2013 16:27:23 -0700 (PDT)
Received: from mout.perfora.net (mout.perfora.net [74.208.4.195]) by ietfa.amsl.com (Postfix) with ESMTP id 61F0221F999B for <json@ietf.org>; Wed, 5 Jun 2013 16:27:18 -0700 (PDT)
Received: from [192.168.114.223] ([216.113.168.135]) by mrelay.perfora.net (node=mrus1) with ESMTP (Nemesis) id 0MYyF9-1UwjJW3XOt-00VRTR; Wed, 05 Jun 2013 19:26:42 -0400
Message-ID: <51AFC924.2030805@crockford.com>
Date: Wed, 05 Jun 2013 16:26:28 -0700
From: Douglas Crockford <douglas@crockford.com>
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6
MIME-Version: 1.0
To: Vinny A <jsontest@yahoo.com>
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>
In-Reply-To: <831B8E46-F239-4353-8F95-8DF3F9BD2E78@yahoo.com>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 7bit
X-Provags-ID: V02:K0:49z0cfc9RUzrQoLn8Ga5tkIcx3LE8d0EimheFvD4muC oS5HWsDbMhK3IIaPb0Xgn0gvYxtcEzxkn7720QfIkd3+xFvoba ATdbmaO8Gvk8w7Mi3RCEj1ni2e+A1EwwieZhLMDUM8BmFb7OH7 T97/QN6q8B15HKzwcWRoCd8Vk5poeLdtgEQSomXfMtHGNYunSD 5S3ga3uZgqx8KukPBV5PYD62q9/00XDw2W6JjTevY4VHAD5b5i 6fVaOEuax88zDHh0pSdfrUv2dmHSc18eNiSKYTvoNE3fKMjyrt XUeQ7/QkEaEjLcs5MZR/C6L/YSaelBiITdJrWKGDuMbthl56iW KBcKb+KHCmrfkuJxZDlDM69e7FsKq+q6BuWyBVz6x
Cc: Eliot Lear <lear@cisco.com>, "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: Wed, 05 Jun 2013 23:27:29 -0000

On 6/5/2013 3:46 PM, Vinny A wrote:
>
> On Jun 5, 2013, at 4:56 PM, Douglas Crockford <douglas@crockford.com 
> <mailto:douglas@crockford.com>> wrote:
> > There are people who interpreted the SHOULD as DON'T HAVE TO and 
> intentionally duplicated the keys. My personal feeling is that we 
> should change the SHOULD to MUST and let those applications break. But 
> the consensus of ECMA TC39 is that the SHOULD must stand.
>
> My personal opinion echoes yours. I understand ECMA's consensus though.
>
> On Jun 5, 2013, at 4:56 PM, Douglas Crockford <douglas@crockford.com 
> <mailto:douglas@crockford.com>> wrote:
> > So regrettably, that means we should be explicit about what happens 
> when this particular bad practice is practiced.
>
> Do we need to add this to the draft? As in (not proposing this, but as 
> fodder for discussion): "The names within an object SHOULD be unique. 
> If duplicate names are encountered, the last key:value pair MUST be used."
>
It think it should be added to the draft. If duplicate names are 
encountered, the parse MAY fail (because some implementations correctly 
do that), or it MAY succeed by accepting the last duplicated key:value pair.