Re: [JSON] I say again, what *is* JSON?

From: Gavin Carothers <gavin@topquadrant.com>
Subject: Re: [JSON] I say again, what *is* JSON?
Date: Thu, 24 Mar 2011 12:56:39 -0500

> On Thu, Mar 24, 2011 at 10:06 AM, Peter Frederick Patel-Schneider
> <pfps@research.bell-labs.com> wrote:
>> From: Gavin Carothers <gavin@topquadrant.com>
>> Subject: Re: [JSON] I say again, what *is* JSON?
>> Date: Thu, 24 Mar 2011 10:53:25 -0500
>>
>>> On Thu, Mar 24, 2011 at 7:35 AM, Peter Frederick Patel-Schneider
>>> <pfps@research.bell-labs.com> wrote:
>>>> Hmm.
>>>>
>>>> Is this really the JSON spec?
>>>
>>> No.
>>>
>>> [... snip ...]
>>>>
>>>>
>>>> So, I ask again, is there a definition JSON somewhere around?
>>>
>>> Yes,  http://www.ietf.org/rfc/rfc4627.txt  it is "just" a grammar.
>>
>> I note that the character encoding here appears to be different from
>> that in the JavaScript document.
> 
> Yep, I believe most JavaScript JSON parsers rely on the browser to "Do
> the right thing", which they do.

But what *is* the right thing?  (I'm not opposed to "the right thing" to
be in some extra document, but it sure would be nice to have such a
document, and have the WG agree on it.) 

>>> The
>>> mapping of JSON into the object model of the parsers language is not
>>> specified.
>>
>> So then, how can the WG talk about round-tripping, etc., etc.?
> 
> A JSON object that is parsed into a language is -likely- to be
> serialized back out the same way. 

Hmm.  I expect that most JSON objects will reserialize as a quite
different sequence of characters, even ignoring white space.

> Exactly what it looks like while in
> the language isn't part of JSON, but is part of JavaScript.

However, the WG is supposed to be relating the RDF data model (i.e.,
graphs, or whatever) to JSON, to it sure would be nice to have some
reference for what data structure corresponds to some JSON text.

>>> From section 2.2:
>>>
>>> The names within an object SHOULD be unique.
>>
>> Hmm.  This doesn't appear in json.org or in the JavaScript document.
>>
>>> While it does say SHOULD, but it is in reality a MUST.
>>
>> Except that there are lots of "MUST"s in the document, so one SHOULD be
>> able to have non-unique names, if the circumstances warrant.
> 
> Right, if we look at the YAML spec
> http://yaml.org/spec/1.2/spec.html#id2759572 (of which JSON is a
> subset) we find:
> 
> JSON's RFC4627 requires that mappings keys merely “SHOULD” be unique,
> while YAML insists they “MUST” be. Technically, YAML therefore
> complies with the JSON spec, choosing to treat duplicates as an error.
> In practice, since JSON is silent on the semantics of such duplicates,
As it is silent on the rest of semantics, so how do duplicates fit here?
> the only portable JSON files are those with unique keys, which are
> therefore valid YAML files.

And what is YAML that the WG should be concerned with it?  Should the WG
restrict itself to the intersction of YAML and JSON (as neither includes
the other)?  This doesn't seem to be a step forward to me.

>>> --Gavin

peter

Received on Thursday, 24 March 2011 18:20:21 UTC