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

Jorge Chamorro <jorge@jorgechamorro.com> Sat, 27 July 2013 22:10 UTC

Return-Path: <jorge@jorgechamorro.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 3211B11E8117 for <json@ietfa.amsl.com>; Sat, 27 Jul 2013 15:10:33 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.599
X-Spam-Level:
X-Spam-Status: No, score=-3.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1]
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 y-RBTDGeWq-1 for <json@ietfa.amsl.com>; Sat, 27 Jul 2013 15:10:27 -0700 (PDT)
Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com [209.85.212.179]) by ietfa.amsl.com (Postfix) with ESMTP id 1EC5411E8116 for <json@ietf.org>; Sat, 27 Jul 2013 15:10:26 -0700 (PDT)
Received: by mail-wi0-f179.google.com with SMTP id hr7so246406wib.0 for <json@ietf.org>; Sat, 27 Jul 2013 15:10:24 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=NC+SblD2JiNr/d0s/4QoaJdcCFSLeDUpA7UqwHD6gtk=; b=eH4kNJO9eASFeim03+G+5gJjHPTCE3yS8n71ML+HPb7CHlQyPwha+49cVNSjP7q7LC cEXt50FPHylLnDy/02vH1omcZPZdoIGTnqAzPoGwsi79bDoT+irHhpinWeOIdzdh13Sf wriagPpQK3Li2IEu2UnEH44OK6/vkpDP2bO2Vt+OpJvBPWVCFUZxDlhTVpvk7bcqp/A8 nZSlxJtAKVAc+8UzraJlznkXmuQNiPGdeVcqWJpBlSqtohmBYG0c2aOvu3yHl0L/+pfW prEDaTi9V1yf5X2naWD51AQm5irQr1e82Xn/0qAohWqNz50+V6UqGrWr8u5nP2tU/mvu zNgw==
X-Received: by 10.194.76.98 with SMTP id j2mr38238652wjw.50.1374963024142; Sat, 27 Jul 2013 15:10:24 -0700 (PDT)
Received: from [192.168.10.50] (4.Red-83-41-147.dynamicIP.rima-tde.net. [83.41.147.4]) by mx.google.com with ESMTPSA id nb12sm13091231wic.7.2013.07.27.15.10.22 for <multiple recipients> (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 27 Jul 2013 15:10:23 -0700 (PDT)
Mime-Version: 1.0 (Apple Message framework v1085)
Content-Type: text/plain; charset="us-ascii"
From: Jorge Chamorro <jorge@jorgechamorro.com>
In-Reply-To: <CA+mHimN9=VZu4RRWcnk2F_uMi-+E-LDN2stb1MFNDP+o1R0WSg@mail.gmail.com>
Date: Sun, 28 Jul 2013 00:10:20 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <EEDD52B0-4577-4789-A3C6-586C3D95D81C@jorgechamorro.com>
References: <51AF8479.5080002@crockford.com> <CAK3OfOgtYoPRZ-Gj5G8AnNipDyxYs=6_KD=rQTxKbhDPX6FZNA@mail.gmail.com> <51b1168c.e686440a.5339.5fc4SMTPIN_ADDED_BROKEN@mx.google.com> <CAK3OfOhL3zXHfg9EEDWLXhjLQ1aBvvxikKAiR+nUpDHJaVh+Qg@mail.gmail.com> <51B1B47C.9060009@drees.name> <C86A9758-5BEF-415C-BD17-DC5E757FAA7E@yahoo.com> <51B1E909.2010402@drees.name> <CA+mHimN9=VZu4RRWcnk2F_uMi-+E-LDN2stb1MFNDP+o1R0WSg@mail.gmail.com>
To: Stephen Dolan <stephen.dolan@cl.cam.ac.uk>
X-Mailer: Apple Mail (2.1085)
X-Gm-Message-State: ALoCoQmIugY3ztWTc+m4uel4PxWslnBND3qlVVWEy/25N+GrPn3S7/jTIF8QRNyHlRBoxtlP+sRh
Cc: Vinny A <jsontest@yahoo.com>, stefan@drees.name, Markus Lanthaler <markus.lanthaler@gmx.net>, "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: Sat, 27 Jul 2013 22:10:33 -0000

On 27/07/2013, at 22:22, Matt Miller (mamille2) wrote:

> Hello all,
> 
> Here is an attempt to summarize responses to the duplicate names questions.
> 
> The consensus from this thread seems to be that duplicate names within the same JSON object are not generally desirable.
> 
> There appears to be rough consensus that a generator (for some definition of "generator") ought to take steps to avoid emitting duplicate names, but that there exists a non-trivial amount of software where the prohibition of duplicates cannot be completely enforced.
> 
> There appears to be consensus that parsers (for some definition of "parser") need to be able to deal with duplicate names in some manner.  There is rough consensus that 4627bis ought to provide guidance on how parsers deal with duplicate names.  However, there is no one option that has any consensus; instead, there appears to be acquiescence that a given parser ought to support one option from a limited set of documented choices.  The most common suggestions -- which appear to reflect the majority of existing implementations -- far so:
> 
> * report an error in some manner
> * report the last value that appears in the JSON text
> * report all the values that appear in the JSON text

If duplicate names are generally considered a no-no, and given that they're mostly used for comments (usually with the key "//"), and given the security risks discussed in the "command":"launch-missiles" thread, perhaps the best thing to do with the duplicate keys and their values might be to simply drop them altogether, not throw any errors, not nothing, just drop them, all of them, including the last one.

So missiles won't be launched and comments will vaporize, which is good.
-- 
( Jorge )();