Re: [Json] Proposed minimal change for duplicate names in objects

John Cowan <cowan@mercury.ccil.org> Wed, 03 July 2013 16:58 UTC

Return-Path: <cowan@ccil.org>
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 D9C5811E811A for <json@ietfa.amsl.com>; Wed, 3 Jul 2013 09:58:17 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.562
X-Spam-Level:
X-Spam-Status: No, score=-3.562 tagged_above=-999 required=5 tests=[AWL=0.038, 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 z4k-ujKGPMFP for <json@ietfa.amsl.com>; Wed, 3 Jul 2013 09:58:13 -0700 (PDT)
Received: from earth.ccil.org (earth.ccil.org [192.190.237.11]) by ietfa.amsl.com (Postfix) with ESMTP id 83BD711E80F2 for <json@ietf.org>; Wed, 3 Jul 2013 09:58:13 -0700 (PDT)
Received: from cowan by earth.ccil.org with local (Exim 4.72) (envelope-from <cowan@ccil.org>) id 1UuQNe-00038M-Bq; Wed, 03 Jul 2013 12:58:10 -0400
Date: Wed, 03 Jul 2013 12:58:10 -0400
From: John Cowan <cowan@mercury.ccil.org>
To: Stefan Drees <stefan@drees.name>
Message-ID: <20130703165810.GF32044@mercury.ccil.org>
References: <B86E1D4B-1DC8-4AD6-B8B3-E989599E0537@vpnc.org> <CAK3OfOj3MNNhjwo2bMa5CgoqynzMRVvviBXC8szxt5D17Z7FDg@mail.gmail.com> <51D3C63C.5030703@cisco.com> <CAK3OfOg5ErNO5zozaCB-qchSaUb-dy4Da5b1KKJNTM0Bnpm+1A@mail.gmail.com> <51D3DC41.4020808@drees.name>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <51D3DC41.4020808@drees.name>
User-Agent: Mutt/1.5.20 (2009-06-14)
Sender: John Cowan <cowan@ccil.org>
Cc: Nico Williams <nico@cryptonector.com>, Paul Hoffman <paul.hoffman@vpnc.org>, Eliot Lear <lear@cisco.com>, "json@ietf.org WG" <json@ietf.org>
Subject: Re: [Json] Proposed minimal change for duplicate names in objects
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, 03 Jul 2013 16:58:18 -0000

Stefan Drees scripsit:

> JSON in the role of data interchange format allows at that point the
> multiset use case. Bad behaviour IMO is when misusing this.
> 
> The expectation, that the unordered list of names in a single object
> must form a set and not a multiset is questionable.

Nevertheless, anyone who generates JSON with duplicate names in order to
represent a multimap deserves to lose, because many, many JSON parsers
will simply throw away all but the last as an unintended consequence of
their implementation strategies.

I assume you mean a multimap rather than a multiset: a multiset would be
most naturally represented as a JSON object whose values are integers
representing the number of occurrences of a particular object in the
multiset.  By the same token, the natural representation of a multiset
is a JSON object whose values are arrays. whose order is semantically
irrelevant.

> {"Stefan":"male","Stefan":"native German","could not resist":true}

{
  "given name" : "John",
  "gender" : "male",
  "citizenship" : {"country" : "US", "source" : "jus soli"},
  "ethnicity" : ["German", "Irish"],
  "annotations" : {
    "verbose" : true,
    "machine-processable" : true
  }
}

-- 
John Cowan                              cowan@ccil.org
            http://www.ccil.org/~cowan
Humpty Dump Dublin squeaks through his norse
                Humpty Dump Dublin hath a horrible vorse
But for all his kinks English / And his irismanx brogues
                Humpty Dump Dublin's grandada of all rogues.  --Cousin James