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

Dean Landolt <dean@deanlandolt.com> Mon, 10 June 2013 12:56 UTC

Return-Path: <dean@deanlandolt.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 EC84F21F8F4A for <json@ietfa.amsl.com>; Mon, 10 Jun 2013 05:56:14 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.376
X-Spam-Level:
X-Spam-Status: No, score=-1.376 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, J_CHICKENPOX_45=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 cVaHIs+wnnWS for <json@ietfa.amsl.com>; Mon, 10 Jun 2013 05:56:09 -0700 (PDT)
Received: from mail-pd0-f171.google.com (mail-pd0-f171.google.com [209.85.192.171]) by ietfa.amsl.com (Postfix) with ESMTP id 4CEAC21F881F for <json@ietf.org>; Mon, 10 Jun 2013 05:56:08 -0700 (PDT)
Received: by mail-pd0-f171.google.com with SMTP id y14so4479673pdi.2 for <json@ietf.org>; Mon, 10 Jun 2013 05:56:07 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:x-gm-message-state; bh=vETk8iP4pGNTL00w+W8gj0sqvX8cYFjv6hO44h/ItzI=; b=h6j0Z3nNnYT0L4cf86gBbGd3GtHUYbJz3a2Sz3SSILd7mFeOr46vKQHksXxXaeAGol fzlc2TeMp7y70dnzaEqaMMWLnpCIXxsG3gXicTdEo8KaF1f9GQYgJfno2/efwQYFoFaM lW6k9bCQUXJh8d+UxF+QcNejUP65UVGJaqxDyJ3q+xKgPUlRUfyI2VRrY2SBIVUVMEaz BCdETvWNr2lUOrBbX+cgrwUZvGgNFtoBSNQSzHZGIIoqEnGTM/uIAMFliUmaRq7EQr6f rSoULYEWXCFfSKS2kD7dl9BOgegJBmeaQGtQTI2wvE5hx0bOSSLa8BNk+qTTdiMaKAVB 97Jg==
X-Received: by 10.68.136.230 with SMTP id qd6mr9604479pbb.112.1370868966955; Mon, 10 Jun 2013 05:56:06 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.70.38.36 with HTTP; Mon, 10 Jun 2013 05:55:25 -0700 (PDT)
In-Reply-To: <51B2121B.5080801@crockford.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> <51AFC924.2030805@crockford.com> <DA7A83A2-1C1F-4E74-BF6A-DA943B07AB59@vpnc.org> <60141305-DCEA-4EC6-9CDF-82B52B13AE91@wirfs-brock.com> <51B20E48.8040109@crockford.com> <944ECA7F-A548-4903-9526-847065066E8E@wirfs-brock.com> <51B2121B.5080801@crockford.com>
From: Dean Landolt <dean@deanlandolt.com>
Date: Mon, 10 Jun 2013 08:55:25 -0400
Message-ID: <CAPm8pjoM6DM8YD43O3TQCU5Np5W7EcOOgp0Y=htd4ybUfCLyMw@mail.gmail.com>
To: Douglas Crockford <douglas@crockford.com>
Content-Type: multipart/alternative; boundary="047d7b10d0dbcf318404decc4d10"
X-Gm-Message-State: ALoCoQmKYSaS57k0pNa4bJHmmC9ANnxjBoZ8iZw+mOnyp1Rod4x9+N4iRz/zoazPty9NyPIHevrd
Cc: Allen Wirfs-Brock <allen@wirfs-brock.com>, 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: Mon, 10 Jun 2013 12:56:16 -0000

On Fri, Jun 7, 2013 at 1:02 PM, Douglas Crockford <douglas@crockford.com>wrote:

> On 6/7/2013 9:59 AM, Allen Wirfs-Brock wrote:
>
>> On Jun 7, 2013, at 9:46 AM, Douglas Crockford wrote:
>>
>>  On 6/6/2013 8:42 AM, Allen Wirfs-Brock wrote:
>>>
>>>> Given that duplicate names have historically been valid, that some
>>>> people use them, and that the standard ECMAScript JSON parser accepts them
>>>> I don't see why allowing a parser to reject duplicate names is helpful.
>>>>
>>>>
>>>>
>>>>  Because some parsers do so, and have for years. JSON.parse is not the
>>> only JSON parser. Our purpose here is not to attempt to fix this thing,
>>> because fixing it will break it. There were unfortunately ambiguities in
>>> the RFC. If we can, we should remove the ambiguities, but we must do so
>>> without changing the meaning of what JSON is.
>>>
>> I think it is more important to preserve the validity of existing
>> archival datasets then it is to preserve the validity of existing parsers
>> that throw on duplicate keys.
>>
>>  We should not be invalidating data or programs. We should only be
> explaining better. No breakage is acceptable. No breakage.



In this case "no breakage" effectively means no hope of interoperability
going forward. What, then, is the point of this exercise? To echo AWB's
point, I've seen the duplicate-keys-for-comments technique used (and
encouraged) by many in the js community for years -- I'm sure there's a
large volume of otherwise-valid json out there. This is handled in a
variety of ways in the wild -- shouldn't this be a high priority to
correct? And all things being equal, programs rot a lot faster than data --
there's no correcting for the mass of historical duplicate-key json.

Another possible solution: specify that parsers MUST NOT throw on duplicate
keys and recommend omitting duplicate keys entirely. Given history I
believe this is the only sane way to handle duplicate keys -- as was noted
earlier in this thread they're completely useless after a
parse/serialization cycle anyway. This may put some noses out of joint but
web reality suggests this is the only robust solution.