Re: [Json] What is a JSON-text? [REVISITED]

Stefan Drees <stefan@drees.name> Thu, 03 October 2013 19:40 UTC

Return-Path: <stefan@drees.name>
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 D800F21E80F4 for <json@ietfa.amsl.com>; Thu, 3 Oct 2013 12:40:45 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.011
X-Spam-Level:
X-Spam-Status: No, score=0.011 tagged_above=-999 required=5 tests=[AWL=-0.300, BAYES_00=-2.599, HELO_EQ_DE=0.35, J_CHICKENPOX_24=0.6, RCVD_IN_BL_SPAMCOP_NET=1.96]
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 AcmJF1rOU9a5 for <json@ietfa.amsl.com>; Thu, 3 Oct 2013 12:40:32 -0700 (PDT)
Received: from mout.web.de (mout.web.de [212.227.15.4]) by ietfa.amsl.com (Postfix) with ESMTP id 91F5221F9B6A for <json@ietf.org>; Thu, 3 Oct 2013 12:22:03 -0700 (PDT)
Received: from newyork.local.box ([93.129.127.38]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0M8iPI-1VXMOA3fEy-00CEYZ for <json@ietf.org>; Thu, 03 Oct 2013 21:21:59 +0200
Message-ID: <524DC3D5.4010806@drees.name>
Date: Thu, 03 Oct 2013 21:21:57 +0200
From: Stefan Drees <stefan@drees.name>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8
MIME-Version: 1.0
To: Nico Williams <nico@cryptonector.com>
References: <BF7E36B9C495A6468E8EC573603ED9411EF2B583@xmb-aln-x11.cisco.com> <CAHBU6iv7gT8nebFnz_mHQVZ3z8Kz+Pb8VRrSkMf44QRqWL8QjA@mail.gmail.com> <524DAEBF.1020509@drees.name> <CAK3OfOhRCCfNWHD-qSXOmswE7DL+QFefE_pvQO5g24NJ9q07hg@mail.gmail.com>
In-Reply-To: <CAK3OfOhRCCfNWHD-qSXOmswE7DL+QFefE_pvQO5g24NJ9q07hg@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K0:h7ZKRnScVo+C2FGXK9AsmHs7r8PJlaaWA/Fx6pI5KBDaKK+5W7O NeXX/n4lxaSMjXhXKytzUNAJmkdRGBqeUtIfEAT6wLMloQ/2GEK8ijgfmBDfIFi+bGjoaPX ZWOTigm46q6CllcpA0SQ73i4dIb82m1rsjkhDYyf9sMgev3A62aN9hzhfenUd8K9bM4EINP 0qxU9nEZW/dXJoObvJQWw==
Cc: "Matt Miller (mamille2)" <mamille2@cisco.com>, Tim Bray <tbray@textuality.com>, JSON WG <json@ietf.org>
Subject: Re: [Json] What is a JSON-text? [REVISITED]
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
Reply-To: stefan@drees.name
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, 03 Oct 2013 19:40:46 -0000

On 2013-10-03 20:24 +02:00, Nico Williams wrote:
> On Thu, Oct 3, 2013 at 12:51 PM, Stefan Drees <stefan@drees.name> wrote:
>> Me also very strongly against "non-container" top-level entities.
>>
>> Additional rationale:
>> - Add two bytes to wrap the serialized/transported value into array or
>>    say six bytes and use eg. {"d":my_top_level_value} should be cheap
>>    for the benefit of producing a JSON-text.
>
> That's very lame; see below for rationale.
>
>> Even if value is king, values like strings, numbers, true, false or null
>> just wrapped into "no clothes" make me wonder why one would serialize (or
>> forward) them as advertised JSON-text in the first place.
>
> Because JSON isn't always used to transport values across networks
> (where it'd be silly to send scalar values with all the overheade of
> HTTP and TCP/IP, say).  JSON is often used for interop between local
> components, where the overhead that would make laughable the use of
> scalar values at the top-level just doesn't apply.  E.g., the Python
> bindings to libjq.  Indeed, here your suggestion that I call "lame"
> *adds* undesirable overhead.
>
> "But JSON is an interchange format for networking" is not a good
> answer to that.  It's a good interchange format, full stop.  The train
> with JSON used for local interchange purposes left the station.  This
> is why parsers commonly have an option to accept scalar values at the
> top-level.


  ... and no one stops implementers nor users from parametrizing a 
parser to adapt to special situations.

Say there is a document named pi.json that contains the text /3.14/ (but 
without the slashes) that may be the (best effort) serialized 
representation of the "number" pi or just the first four bytes, as the 
file became truncated (or the local message content if you are so 
inclined). As a JSON text wraped inside array or object, the situation 
would be clear, in the above "unwrapped" case it is not anymore.

So I think, the above '[...]values like strings, numbers, true, false or 
null just wrapped into "no clothes" make me wonder why one would 
serialize (or forward) them as advertised JSON-text in the first place.' 
remains as it stands, doesn't it?

Whatever un-"lame" and un-"laughable" ;-) "train has left the station", 
I guess that without making "wrapping" mandatory for JSON-text, one 
might consider JSON-izing every binary protocol on earth into such an 
unwrapped JSON+* channel (by combining the unlimited "number" feature of 
the JSON rfc and "interpreting" some representation bilaterally 
negotiated as the underlying bit pattern for the stored/transmitted 
binary protocol message).

The set of relations, where one uses JSON as a means to communicate 
between otherwise unrelated components, that are on one hand so closely 
coupled, that no wrapping is needed, but on the other hand so far apart, 
that they cannot accept non JSON-text (as it stands now) looks similar 
to the empty set to me, but I am sure, people will let me soon know of 
exotic situations ... :-)

["Stefan"]