Re: [Json] Call for real-world examples of how parsers deal with duplicate keys

Vinny A <jsontest@yahoo.com> Thu, 06 June 2013 19:39 UTC

Return-Path: <jsontest@yahoo.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 3414011E80FD for <json@ietfa.amsl.com>; Thu, 6 Jun 2013 12:39:39 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.282
X-Spam-Level:
X-Spam-Status: No, score=0.282 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, HTML_FONT_FACE_BAD=0.884, HTML_MESSAGE=0.001, J_CHICKENPOX_34=0.6, MIME_QP_LONG_LINE=1.396]
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 FijnLblKHwfT for <json@ietfa.amsl.com>; Thu, 6 Jun 2013 12:39:34 -0700 (PDT)
Received: from nm6-vm5.bullet.mail.gq1.yahoo.com (nm6-vm5.bullet.mail.gq1.yahoo.com [98.136.218.196]) by ietfa.amsl.com (Postfix) with ESMTP id ADE5011E80FA for <json@ietf.org>; Thu, 6 Jun 2013 12:39:34 -0700 (PDT)
Received: from [98.137.12.174] by nm6.bullet.mail.gq1.yahoo.com with NNFMP; 06 Jun 2013 19:39:34 -0000
Received: from [98.136.185.28] by tm13.bullet.mail.gq1.yahoo.com with NNFMP; 06 Jun 2013 19:39:34 -0000
Received: from [127.0.0.1] by smtp109.mail.gq1.yahoo.com with NNFMP; 06 Jun 2013 19:39:34 -0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1370547574; bh=b4qJxeYYyXJWnDIEM9WbU4FN2tm8Ce50dznlFJnrFZc=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:References:In-Reply-To:Mime-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Cc:X-Mailer:From:Subject:Date:To; b=CG7Rld48murcmfnxjTThLwb4PfnV1rA1Hly+Cr8lrsaw+SKtLbCnqUdzFUuClaScAYH8rsTT0Dokbk66K0viF9PlNpGuHTKbMStxfWZv9I1t9fMp0DW5dI+4tAvVjyqodmCOjRayFMiPU1NIjFgqpL7fuxnI5BQUUF3LuPUznSc=
X-Yahoo-Newman-Id: 240062.78233.bm@smtp109.mail.gq1.yahoo.com
X-Yahoo-Newman-Property: ymail-3
X-YMail-OSG: DPhL9.kVM1kZxU9UGFrnsSn5MumDkuU6.qS_aQW.GBD1hQj Ls4gMZfMngwMO7sf3wxACUg5_PkRY6Aug9SH9Yh4nbOZIPJfSPqt7mq0weP_ YEw7r1T5HKycGIbD3yj0wJNac7aCEUvmRHeFm3YVq4HeuBmpjganCY1ifCNF j.e4YZoJb94jCo0ETW_AqMItQhXOy2KUZuh_NuTo4wvJLcMFeWarvS9Q36Li S5tJAIa8a75bOckmuFqLRMHwmaXOPHi65EUo_jJ7J9ZTwNHPbBSH9KMN9UhI dxRYHrrbkv5mRJDm6J0F2R8yAFidLXcLfCFDqB6Tsw3v4LrOI2rFndzpzHbD 7ubh7rNyqSJcZwU4_JR1lkAeZLLkgwrGtuUMhd6cLjNeO.lw70R2WTQr3DVT 1SZ5wNKDjiytSS6CuM7lxfK6eJwJOWwK.w4lxqdBV6JOs8le0GRuJHIox12Q eSY8OgDTQTqjPhHczemD7NYtdm5t58SAhbqAX__g1JJUDrTjAO98V1v2L_9i AIWmhmwowch7tZSc2dKEuqU0FvgiJ90ppb8xOPtAWObDMQ6BbkI322AeoXk7 S76YzInDpClWv93xvhqt5nsWMdMvCLj62R2F5jed8T0PlK7gzekrreBH5PWB HFBBproDdHifbGOYm4wd11qo2mc66D3ikGgqNH9HUZAvKFt9XXsPxdRiGNSW 0E6o-
X-Yahoo-SMTP: indQcmSswBC8IKsm6t4aCAPskK3T
X-Rocket-Received: from [192.168.0.102] (jsontest@76.29.100.42 with ) by smtp109.mail.gq1.yahoo.com with SMTP; 06 Jun 2013 12:39:34 -0700 PDT
References: <C79C116D-16A4-41BA-9E5A-1055E6B9C941@vpnc.org>
In-Reply-To: <C79C116D-16A4-41BA-9E5A-1055E6B9C941@vpnc.org>
Mime-Version: 1.0 (1.0)
Content-Type: multipart/alternative; boundary="Apple-Mail-36B71595-1036-47EB-B83E-CB1640DF82D1"
Content-Transfer-Encoding: 7bit
Message-Id: <68781957-C96E-4D30-96F3-6C50B59B7DAE@yahoo.com>
X-Mailer: iPod Mail (9B206)
From: Vinny A <jsontest@yahoo.com>
Date: Thu, 06 Jun 2013 14:39:33 -0500
To: Paul Hoffman <paul.hoffman@vpnc.org>
Cc: "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] Call for real-world examples of how parsers deal with duplicate keys
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 19:39:39 -0000

The org.json reference parser causes an exception when it hits a duplicated key. See https://github.com/douglascrockford/JSON-java/blob/master/JSONObject.java , line 1186, in putOnce.


-----------------
Vinny
www.jsontest.com

On Jun 6, 2013, at 12:41 PM, Paul Hoffman <paul.hoffman@vpnc.org> wrote:

> Greetings again. Knowing what current parsers do with duplicate keys might be useful to this discussion. Of course, some people will exclaim "but that's wrong!" to some of what we see, but seeing it may be useful nonetheless.
> 
> I propose the following JSON text for the tests:
> 
> {"a":1,"a":2}
> 
> --Paul Hoffman
> 
> ==============================
> 
> And I'll start with Python.
> 
> from __future__ import print_function
> import json
> a = '{"a":1,"a":2}'
> print(json.loads(a))
> 
> # python2.6 keytest.py
> {u'a': 2}
> # python2.7 keytest.py
> {u'a': 2}
> # python3.2 keytest.py
> {'a': 2}
> 
> 
> _______________________________________________
> json mailing list
> json@ietf.org
> https://www.ietf.org/mailman/listinfo/json