Re: [Json] Allow any JSON value at the top level

Nico Williams <nico@cryptonector.com> Fri, 07 June 2013 16:52 UTC

Return-Path: <nico@cryptonector.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 EBAA621F86D5 for <json@ietfa.amsl.com>; Fri, 7 Jun 2013 09:52:51 -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=[AWL=0.000, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622]
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 ZBuyzF4H5qpa for <json@ietfa.amsl.com>; Fri, 7 Jun 2013 09:52:47 -0700 (PDT)
Received: from homiemail-a70.g.dreamhost.com (caiajhbdcbhh.dreamhost.com [208.97.132.177]) by ietfa.amsl.com (Postfix) with ESMTP id ED78921F8717 for <json@ietf.org>; Fri, 7 Jun 2013 09:52:46 -0700 (PDT)
Received: from homiemail-a70.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a70.g.dreamhost.com (Postfix) with ESMTP id 951B376806D for <json@ietf.org>; Fri, 7 Jun 2013 09:52:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=cryptonector.com; h= mime-version:in-reply-to:references:date:message-id:subject:from :to:cc:content-type; s=cryptonector.com; bh=wiYgxv06NyxghDIC6yVN g9vft6c=; b=MHVzVEHCYrlzhmWKxdj37UUxJpk1/EIe6RMr/Asj3dS2cSSkthpY XwP0YYcvtxpsXPn1dcnlqydHUXeHyylbMFCsJB8byY1pIHu7GCycHKweBHnPtCha wyl1rH7yrwbODiK9ilNZ8VHI6j71PcfIKAWDWKH6/A0T231GQZgfX+M=
Received: from mail-we0-f175.google.com (mail-we0-f175.google.com [74.125.82.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: nico@cryptonector.com) by homiemail-a70.g.dreamhost.com (Postfix) with ESMTPSA id 49EEE768070 for <json@ietf.org>; Fri, 7 Jun 2013 09:52:46 -0700 (PDT)
Received: by mail-we0-f175.google.com with SMTP id t59so3305844wes.34 for <json@ietf.org>; Fri, 07 Jun 2013 09:52:44 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=tWXFLnOin8yOk+1usxyl0KJG9DBrfFPTip49kg2PUAE=; b=RVNYs//DIZP0n+Qy+UIqM/DG/qYztPzcfqkOj1zE9F7i7Lx0hPHYctUtriUV3o94X4 wNhuRlmMCBzPRlXH3PWPY6PegpFd8Gp0MlWE2tJSfIFh/bfVAaXy/KIjZVD1p6xdm8zK Lk7EvJI0cg8Z3LpDp6gI2plYg8Dci3dVulqbLGsZUToBHxWBv5X9WH9MonNRt9S9KUzF ws9LvzFV88xfoY1SNQnIh9s5uISw5tyXqorBI8Kq098zRCQ9Wci/otI0FHU+yD/uj734 mvT7noN+JDBkVLXNWrii2NBxg9LJaK9aYdRK8SwQyuoCzQBbhWx3YDUd6V0KEYJW6u/C N6Zw==
MIME-Version: 1.0
X-Received: by 10.194.24.8 with SMTP id q8mr4919450wjf.81.1370623964889; Fri, 07 Jun 2013 09:52:44 -0700 (PDT)
Received: by 10.216.63.136 with HTTP; Fri, 7 Jun 2013 09:52:44 -0700 (PDT)
In-Reply-To: <51B20529.2040906@drees.name>
References: <255B9BB34FB7D647A506DC292726F6E1151B21F9A9@WSMSG3153V.srv.dir.telstra.com> <3B4E7F65-B9B9-4C95-B077-D178B8DD8216@vpnc.org> <51B20529.2040906@drees.name>
Date: Fri, 07 Jun 2013 11:52:44 -0500
Message-ID: <CAK3OfOhPBkjSyYUxGvccXVQ1Wjxh1YK7_rtXYB7xHpw4L703sg@mail.gmail.com>
From: Nico Williams <nico@cryptonector.com>
To: stefan@drees.name
Content-Type: text/plain; charset="UTF-8"
Cc: Paul Hoffman <paul.hoffman@vpnc.org>, "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] Allow any JSON value at the top level
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: Fri, 07 Jun 2013 16:52:53 -0000

On Fri, Jun 7, 2013 at 11:07 AM, Stefan Drees <stefan@drees.name> wrote:
> On 07.06.13 17:40, Paul Hoffman wrote:
>>
>> <no hat>
>>
>> On Jun 6, 2013, at 8:51 PM, "Manger, James H"
>> <james.h.manger@team.telstra.com> wrote:
>>
>>> The current spec only allows a JSON text to be an object or array.
>>> Section 2. "JSON Grammar" says:
>>>
>>>    A JSON text is a serialized object or array.
>>>
>>>    JSON-text = object / array
>>>
>>>
>>> I propose allowing a JSON text to be any JSON value.
>>>
>>>    A JSON text is a serialization of any JSON value.
>>>
>>>    JSON-text = value
>>>
>>>    value = false / null / true / object / array / number / string
>>
>>
>> +1 to this, and to removing the "how to tell if you are looking at a
>> JSON text" from the parser section. That rule is fragile and not useful.
>>
>
> +0 as long as the future encoding detection tricks in section 3 are coherent
> with it.

If the top-level may be any value then we still have the first
character being ASCII and the section 3 encoding detection algorithm
still works:

           00 00 00 xx  UTF-32BE
           00 xx  UTF-16BE
           xx 00  UTF-32LE
           xx 00  UTF-16LE
           xx xx  UTF-8

I'm in favor of this change, but I'd be happy to have the new RFC
allow for parsers that can't handle this.

Nico
--