Re: [Json] The names within an object SHOULD be unique.
Tatu Saloranta <tsaloranta@gmail.com> Thu, 06 June 2013 17:36 UTC
Return-Path: <tsaloranta@gmail.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 F205621F9948 for <json@ietfa.amsl.com>; Thu, 6 Jun 2013 10:36:09 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.888
X-Spam-Level:
X-Spam-Status: No, score=-1.888 tagged_above=-999 required=5 tests=[AWL=0.712, BAYES_00=-2.599, HTML_MESSAGE=0.001, NO_RELAYS=-0.001]
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 p90MVXAzLrNs for <json@ietfa.amsl.com>; Thu, 6 Jun 2013 10:36:09 -0700 (PDT)
Received: from mail-wg0-x231.google.com (mail-wg0-x231.google.com [IPv6:2a00:1450:400c:c00::231]) by ietfa.amsl.com (Postfix) with ESMTP id 83EAC21F9A8B for <json@ietf.org>; Thu, 6 Jun 2013 10:36:08 -0700 (PDT)
Received: by mail-wg0-f49.google.com with SMTP id a12so513457wgh.4 for <json@ietf.org>; Thu, 06 Jun 2013 10:36:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=0n5kLvuIM5SmFH6aWM8/6HBkMX4ckWhYZZqJ3baz4co=; b=snH32EwZHJzMbEjENgGzDXP26H1xMRLFeNO9JDst5ztuP9lJoDSKmK42h952hg/zDp RZaEn2JI0r0aNJ08U0LibM0aZG4kHqrOE5W6WEHnhSixGDxnrfqP2heRSdz/5YD2s5Cq WQu7a7zOdtgEhnJreFVgJrjlKjtyNwp9zE0xahMqYWF0goiEzDyUbMYbVKQ2dSDdhd+t MUIvKwyh52HrODGkW1vBFGoIcZL7qQfCMBqlm/Z/qm0EqCyKu7Pipf3pp14/h9dWykB7 7HZ722Kas6QKUDu6JGW1kwCe92ocqMt2K5e/X63Q9BoZMWMaG1Gm6WFEVt6nar2Fd4Cm q37g==
MIME-Version: 1.0
X-Received: by 10.180.184.2 with SMTP id eq2mr10450243wic.50.1370540167624; Thu, 06 Jun 2013 10:36:07 -0700 (PDT)
Received: by 10.227.97.6 with HTTP; Thu, 6 Jun 2013 10:36:07 -0700 (PDT)
In-Reply-To: <386096B1-A43E-43E1-AD03-90424958D9B3@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> <51AFC924.2030805@crockford.com> <DA7A83A2-1C1F-4E74-BF6A-DA943B07AB59@vpnc.org> <E2E04B23-0853-45B4-A028-5DF467042049@yahoo.com> <386096B1-A43E-43E1-AD03-90424958D9B3@yahoo.com>
Date: Thu, 06 Jun 2013 10:36:07 -0700
Message-ID: <CAGrxA27GugSm-b0C_ogxAb8dLC4UpxiuaXeo=B0UsDzc_DCQHg@mail.gmail.com>
From: Tatu Saloranta <tsaloranta@gmail.com>
To: Vinny A <jsontest@yahoo.com>
Content-Type: multipart/alternative; boundary="001a11c3660cd780af04de7fbf42"
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: Thu, 06 Jun 2013 17:36:10 -0000
On Thu, Jun 6, 2013 at 9:40 AM, Vinny A <jsontest@yahoo.com> wrote: > 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 keys have > unpredictable effects (refer to sections 4 & 5).* > > This sounds good. > 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.* > I find this problematic from streaming parsing perspective: if JSON content is to be exposed as a stream of tokens, then this behavior is impractical to implement. Even exposing just the first such key (or entry) is problematic due to need to keep track of all seen keys. But at least it is more practical than filtering out all but last. Streaming parsing is the natural way to level processing, similar to XML division of labor (SAX/Stax in Java, DOM/databind/XSLT on top), and although more commonly used by frameworks and not end users, is an important and common use case. -+ Tatu +-
- Re: [Json] The names within an object SHOULD be u… Eliot Lear
- Re: [Json] The names within an object SHOULD be u… Tim Bray
- [Json] The names within an object SHOULD be uniqu… Douglas Crockford
- Re: [Json] The names within an object SHOULD be u… Douglas Crockford
- Re: [Json] The names within an object SHOULD be u… John Cowan
- Re: [Json] The names within an object SHOULD be u… Markus Lanthaler
- Re: [Json] The names within an object SHOULD be u… Stephan Beal
- Re: [Json] The names within an object SHOULD be u… Nico Williams
- Re: [Json] The names within an object SHOULD be u… Markus Lanthaler
- Re: [Json] The names within an object SHOULD be u… Vinny A
- Re: [Json] The names within an object SHOULD be u… Stephan Beal
- Re: [Json] The names within an object SHOULD be u… Douglas Crockford
- Re: [Json] The names within an object SHOULD be u… Vinny A
- Re: [Json] The names within an object SHOULD be u… Vinny A
- Re: [Json] The names within an object SHOULD be u… Nico Williams
- Re: [Json] The names within an object SHOULD be u… Nico Williams
- Re: [Json] The names within an object SHOULD be u… Douglas Crockford
- Re: [Json] The names within an object SHOULD be u… Joe Hildebrand (jhildebr)
- Re: [Json] The names within an object SHOULD be u… Tim Bray
- Re: [Json] The names within an object SHOULD be u… Matthew Morley
- Re: [Json] The names within an object SHOULD be u… Tatu Saloranta
- Re: [Json] The names within an object SHOULD be u… Joe Hildebrand (jhildebr)
- Re: [Json] The names within an object SHOULD be u… Stefan Drees
- Re: [Json] The names within an object SHOULD be u… Joe Hildebrand (jhildebr)
- Re: [Json] The names within an object SHOULD be u… Bjoern Hoehrmann
- Re: [Json] The names within an object SHOULD be u… Douglas Crockford
- Re: [Json] The names within an object SHOULD be u… Tony Hansen
- Re: [Json] The names within an object SHOULD be u… Stephan Beal
- Re: [Json] The names within an object SHOULD be u… Paul Hoffman
- Re: [Json] The names within an object SHOULD be u… Stephan Beal
- Re: [Json] The names within an object SHOULD be u… Vinny A
- Re: [Json] The names within an object SHOULD be u… Matthew Morley
- Re: [Json] The names within an object SHOULD be u… Markus Lanthaler
- Re: [Json] The names within an object SHOULD be u… Paul Hoffman
- Re: [Json] The names within an object SHOULD be u… Tatu Saloranta
- Re: [Json] The names within an object SHOULD be u… Tatu Saloranta
- Re: [Json] The names within an object SHOULD be u… Pete Cordell
- Re: [Json] The names within an object SHOULD be u… Nico Williams
- Re: [Json] The names within an object SHOULD be u… Matt Miller (mamille2)
- Re: [Json] The names within an object SHOULD be u… John Cowan
- Re: [Json] The names within an object SHOULD be u… Nico Williams
- Re: [Json] The names within an object SHOULD be u… Nico Williams
- Re: [Json] The names within an object SHOULD be u… Paul Hoffman
- Re: [Json] The names within an object SHOULD be u… Nico Williams
- Re: [Json] The names within an object SHOULD be u… Markus Lanthaler
- Re: [Json] The names within an object SHOULD be u… Tatu Saloranta
- Re: [Json] The names within an object SHOULD be u… Tatu Saloranta
- Re: [Json] The names within an object SHOULD be u… John Cowan
- Re: [Json] The names within an object SHOULD be u… Nico Williams
- Re: [Json] The names within an object SHOULD be u… R S
- Re: [Json] The names within an object SHOULD be u… Tim Bray
- Re: [Json] The names within an object SHOULD be u… Vinny A
- Re: [Json] The names within an object SHOULD be u… Markus Lanthaler
- Re: [Json] The names within an object SHOULD be u… Stefan Drees
- Re: [Json] The names within an object SHOULD be u… Vinny A
- Re: [Json] The names within an object SHOULD be u… Stefan Drees
- Re: [Json] The names within an object SHOULD be u… Vinny A
- Re: [Json] The names within an object SHOULD be u… Stephen Dolan
- Re: [Json] The names within an object SHOULD be u… Stefan Drees
- Re: [Json] The names within an object SHOULD be u… Paul Hoffman
- Re: [Json] The names within an object SHOULD be u… Matt Miller (mamille2)
- Re: [Json] The names within an object SHOULD be u… Allen Wirfs-Brock
- Re: [Json] The names within an object SHOULD be u… Allen Wirfs-Brock
- Re: [Json] The names within an object SHOULD be u… Douglas Crockford
- Re: [Json] The names within an object SHOULD be u… Nico Williams
- Re: [Json] The names within an object SHOULD be u… Allen Wirfs-Brock
- Re: [Json] The names within an object SHOULD be u… Douglas Crockford
- Re: [Json] The names within an object SHOULD be u… Jacob Davies
- Re: [Json] The names within an object SHOULD be u… Tim Bray
- Re: [Json] The names within an object SHOULD be u… Vinny A
- Re: [Json] The names within an object SHOULD be u… Allen Wirfs-Brock
- Re: [Json] The names within an object SHOULD be u… Nico Williams
- Re: [Json] The names within an object SHOULD be u… John Cowan
- Re: [Json] The names within an object SHOULD be u… R S
- Re: [Json] The names within an object SHOULD be u… Stephen Dolan
- Re: [Json] The names within an object SHOULD be u… Stefan Drees
- Re: [Json] The names within an object SHOULD be u… Nico Williams
- Re: [Json] The names within an object SHOULD be u… Stefan Drees
- Re: [Json] The names within an object SHOULD be u… Nico Williams
- Re: [Json] The names within an object SHOULD be u… Dean Landolt
- Re: [Json] The names within an object SHOULD be u… John Cowan
- Re: [Json] The names within an object SHOULD be u… Marcos Caceres
- Re: [Json] The names within an object SHOULD be u… Stephen Dolan
- Re: [Json] The names within an object SHOULD be u… Paul Hoffman
- Re: [Json] The names within an object SHOULD be u… Stephen Dolan
- Re: [Json] The names within an object SHOULD be u… Nico Williams
- Re: [Json] The names within an object SHOULD be u… John Cowan
- Re: [Json] The names within an object SHOULD be u… Stefan Drees
- Re: [Json] The names within an object SHOULD be u… Nico Williams
- Re: [Json] The names within an object SHOULD be u… Stephan Beal
- Re: [Json] The names within an object SHOULD be u… John Levine
- Re: [Json] The names within an object SHOULD be u… Stephen Dolan
- Re: [Json] The names within an object SHOULD be u… Jorge Chamorro
- Re: [Json] The names within an object SHOULD be u… John Cowan
- Re: [Json] The names within an object SHOULD be u… Jorge Chamorro
- Re: [Json] The names within an object SHOULD be u… John Cowan
- Re: [Json] The names within an object SHOULD be u… Jorge Chamorro
- Re: [Json] The names within an object SHOULD be u… Joe Hildebrand (jhildebr)
- Re: [Json] The names within an object SHOULD be u… John Cowan
- Re: [Json] fun with streaming, was The names with… John Levine
- Re: [Json] fun with streaming, was The names with… Tim Bray
- Re: [Json] fun with streaming, was The names with… Nico Williams
- Re: [Json] fun with streaming, was The names with… Stephan Beal
- Re: [Json] fun with streaming, was The names with… Tatu Saloranta
- Re: [Json] The names within an object SHOULD be u… Jorge Chamorro
- Re: [Json] The names within an object SHOULD be u… Tatu Saloranta
- Re: [Json] fun with streaming, was The names with… Jorge Chamorro
- Re: [Json] fun with streaming, was The names with… John R Levine
- Re: [Json] fun with streaming, was The names with… Vinny A
- Re: [Json] fun with streaming, was The names with… Joe Hildebrand (jhildebr)
- Re: [Json] fun with streaming, was The names with… Tatu Saloranta