Re: [Json] Differences between RFC 4627 or the current ECMAScript specification

Tony Hansen <tony@att.com> Mon, 30 September 2013 14:09 UTC

Return-Path: <tony@att.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 E65B921F8FAC for <json@ietfa.amsl.com>; Mon, 30 Sep 2013 07:09:49 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -104.395
X-Spam-Level:
X-Spam-Status: No, score=-104.395 tagged_above=-999 required=5 tests=[AWL=-2.016, BAYES_00=-2.599, DATE_IN_PAST_24_48=1.219, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-1, USER_IN_WHITELIST=-100]
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 b3+0UZnFHsaA for <json@ietfa.amsl.com>; Mon, 30 Sep 2013 07:09:43 -0700 (PDT)
Received: from flpi406.enaf.ffdc.sbc.com (egssmtp03.att.com [144.160.128.152]) by ietfa.amsl.com (Postfix) with ESMTP id 4F68621F8546 for <json@ietf.org>; Mon, 30 Sep 2013 07:09:42 -0700 (PDT)
Received: from mailgw1.maillennium.att.com (maillennium.att.com [135.25.114.99]) by egssmtp03.att.com (8.14.4/8.14.4) with ESMTP id r8UE9dYK027326 for <json@ietf.org>; Mon, 30 Sep 2013 07:09:41 -0700
Received: from [135.70.224.43] (vpn-135-70-224-43.vpn.east.att.com[135.70.224.43]) by maillennium.att.com (mailgw1) with ESMTP id <20130930140937gw1009k100e> (Authid: tony); Mon, 30 Sep 2013 14:09:37 +0000
X-Originating-IP: [135.70.224.43]
Message-ID: <524761DD.7080102@att.com>
Date: Sat, 28 Sep 2013 19:10:21 -0400
From: Tony Hansen <tony@att.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8
MIME-Version: 1.0
To: JSON WG <json@ietf.org>
References: <BF7E36B9C495A6468E8EC573603ED9411EF1BB0B@xmb-aln-x11.cisco.com> <CAChr6SyznBktmOLpT-EiZ5Nm_0jZ16M0tOo4aZ_jhSDb=HHDqg@mail.gmail.com> <23C96FBA-3419-4C97-A075-462F7443013A@vpnc.org> <CAChr6SxCpvGaZSGUDs+6vR4A5xv3NfzpRSkwsE_7c8ep+EX=YA@mail.gmail.com> <0FA0EFFF-2109-4D78-8723-2ECD990C0F82@vpnc.org> <CAChr6SwxgG=P2CYSfHkviG8+2vz6yK1fZQNMCvyWXrM1NgzLZQ@mail.gmail.com> <7058DBBD-9DCE-4A5C-B11D-5FC41A839407@vpnc.org> <CAChr6SwR+04Dcwy=WSf-zVgQ_Nwj_Ke5_dppuqk=CLz8BmdMiA@mail.gmail.com> <5245A56D.4080205@att.com> <CAChr6SziP6b0Zk63tmnvrmKq+Fgw7Kgcg7Z+=tCpDSLUa8YMYg@mail.gmail.com>
In-Reply-To: <CAChr6SziP6b0Zk63tmnvrmKq+Fgw7Kgcg7Z+=tCpDSLUa8YMYg@mail.gmail.com>
X-Enigmail-Version: 1.5.2
Content-Type: multipart/alternative; boundary="------------050104010108010201080301"
Subject: Re: [Json] Differences between RFC 4627 or the current ECMAScript specification
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, 30 Sep 2013 14:09:50 -0000

On 9/27/2013 12:34 PM, R S wrote:
> On Fri, Sep 27, 2013 at 8:34 AM, Tony Hansen <tony@att.com
> <mailto:tony@att.com>> wrote:
>
>     RFC 4627 does not allow trailing commas in objects. Nor does
>     4627-bis. 
>
>
> RFC 4627 allows parsers to accept non-JSON if they wish, while
> ECMAScript does not allow this.

Your claim was that you had to change your parser of JSON to no longer
allow trailing commas because of converting to parsing ECMAScript. I
disagree with that assessment.

You had added your own non-standard extension to JSON (accepting
trailing commas) to your parser. Note that ECMA's restrictions on
parsers are only on implementations of ECMAScript. ECMA does NOT say
that *your* parser may not continue to accept trailing commas, except in
the specific case of your parser being used in an implementation of
ECMAScript's JSON.parse() function. That is, if your function is not
used in an implementation of JSON.parse(), ECMA places no restrictions
on it; it certainly is not restricted in the same ways that ECMAScript's
JSON.parse() is restricted. You chose to remove that non-standard
extension, but only because you chose to *follow* the same restrictions
as ECMAScript's JSON.parse().

Did the JSON spec say you could add your own extension to your parser?
Yes it did. However, if someone wrote JSON using a trailing comma,
they're going into non-interoperable territory.

ECMA also extends 4627-JSON by accepting additional top-level
primitives. ECMA's JSON.parse() is still a 4627-JSON-compliant parser
because it properly interprets 4627-JSON. However, someone writing JSON
using ECMA's extensions will only safely be interoperable with someone
using ECMAScript's JSON.parse() or another parser that's been similarly
extended. But they aren't interoperable with the many other JSON
libraries that haven't been similarly extended.

    Tony Hansen