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

Matthew Morley <matt@mpcm.com> Thu, 06 June 2013 16:56 UTC

Return-Path: <mmorley@mpcm.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 672EE21F9A35 for <json@ietfa.amsl.com>; Thu, 6 Jun 2013 09:56:19 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.977
X-Spam-Level:
X-Spam-Status: No, score=-1.977 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, 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 MFyyuqMcn7cc for <json@ietfa.amsl.com>; Thu, 6 Jun 2013 09:56:18 -0700 (PDT)
Received: from mail-la0-x236.google.com (mail-la0-x236.google.com [IPv6:2a00:1450:4010:c03::236]) by ietfa.amsl.com (Postfix) with ESMTP id 5ED2E21F9A2F for <json@ietf.org>; Thu, 6 Jun 2013 09:56:18 -0700 (PDT)
Received: by mail-la0-f54.google.com with SMTP id ec20so2815125lab.13 for <json@ietf.org>; Thu, 06 Jun 2013 09:56:17 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=Ehp6tJM4DkgZbT640jchRasT8/NijlbAGe9gpUvg0C4=; b=F8Hl/e6NDkWzqHHLKUbFnHNnyH3eLYVpJ3nrBdQjLnpTrac+HE4D0Qk3VJRKMMzfO4 1V9RISqROarU2QTeNJ1gbBdMEsPpLF09IDXOMaR77Fb4kS+RWD0TNI3ZcvryBD2a6zkb T7whlYkm8WgvqgqOkFLbMQLKK1ejgAeQIvSgw5ExoSa5lmDYVYaS4rJPQ8zEyAF9xL8e i5p54OjJ4Bo5ceCXUtRlLIsMpKJwuGHvO18PqdPAJ/UqwAXUmY7H5w9lNkKccK1IQyFp cKiSALBDsdL76iRZ8lNRzuCfppjnGb4wLZongk66+Rm3v7LPVna4+D219NQMphjTaRdG 58lw==
MIME-Version: 1.0
X-Received: by 10.152.4.101 with SMTP id j5mr565912laj.67.1370537777145; Thu, 06 Jun 2013 09:56:17 -0700 (PDT)
Sender: mmorley@mpcm.com
Received: by 10.114.160.69 with HTTP; Thu, 6 Jun 2013 09:56:17 -0700 (PDT)
In-Reply-To: <A723FC6ECC552A4D8C8249D9E07425A70FC2E2BD@xmb-rcd-x10.cisco.com>
References: <CAOXDeqrnnZcoXtdwZof4QZbHXAxWtR_agF=foyCAOjEyXAvnPw@mail.gmail.com> <A723FC6ECC552A4D8C8249D9E07425A70FC2E2BD@xmb-rcd-x10.cisco.com>
Date: Thu, 06 Jun 2013 12:56:17 -0400
X-Google-Sender-Auth: fQnpGygfcsQCql-XpdD-byt2KOE
Message-ID: <CAOXDeqoXmd_PQC6HXeuVUGrX+3JVBW1a=garJnSYpte6R1rQ2A@mail.gmail.com>
From: Matthew Morley <matt@mpcm.com>
To: "Joe Hildebrand (jhildebr)" <jhildebr@cisco.com>
Content-Type: multipart/alternative; boundary="089e0149423c5bbad804de7f31dc"
X-Gm-Message-State: ALoCoQntM8tPmSNzrLqxiMYgItUsCidd/ijzzyCnaIadcmzKaZH9U00bDGx66K6slZPr6htlLzuF
Cc: Nico Williams <nico@cryptonector.com>, Stephan Beal <sgbeal@googlemail.com>, 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: Thu, 06 Jun 2013 16:56:19 -0000

On Wed, Jun 5, 2013 at 11:44 PM, Joe Hildebrand (jhildebr) <
jhildebr@cisco.com> wrote:

> On 6/5/13 7:56 PM, "Matthew Morley" <matt@mpcm.com> wrote:
>
> >The best way to handle 'comments' is to have them be first class citizens
> >in the data. It is a topic that goes back a long way, and since they were
> >removed with intention then, using ambiguity in the specification to
> >re-add them seems like a poor approach
> > now.
>
> Do you have a backward-compatible proposal?  I can't think of one, but
> that doesn't make it impossible.
>

Nope :)

I was meaning that the comment should be in data structure itself, existing
as a pattern of usage in JSON, rather than part of the JSON specification.


There are examples of adding "_comment_{foo}":"comment on pair foo" to
objects and insertion of {"_comment_0":"comment on index 0"} into arrays.
With the expectation that those comment keys and comment objects be
stripped if their existence will break schema expectations. But it goes a
bit further than just that, in that comments on a top level array or object
would require the payload being wrapped in an array with the 0 index being
the comment object, and the 1 index being the real payload.

It is the unordered nature of keys, that makes the use of duplicate keys
for comments seem like a very strange choice. Every time I look at a JSON
object, I try to imagine the keys (usually on a single line with the value)
constantly shifting their order and cycling around. That is the reality of
what can happen as it encodes/decodes and gets passed around.

-- 
Matthew P. C. Morley