W3C home > Mailing lists > Public > www-tag@w3.org > October 2013

Re: [Json] FYI ECMA, W3C, IETF coordination on JSON

From: Allen Wirfs-Brock <allen@wirfs-brock.com>
Date: Tue, 8 Oct 2013 12:37:43 -0700
Cc: Larry Masinter <masinter@adobe.com>, Tim Bray <tbray@textuality.com>, "www-tag@w3.org" <www-tag@w3.org>, JSON WG <json@ietf.org>
Message-Id: <87FFB7EC-C0D3-4269-82AA-1D73E47A00FF@wirfs-brock.com>
To: Peter F. Patel-Schneider <pfpschneider@gmail.com>

On Oct 8, 2013, at 9:37 AM, Peter F. Patel-Schneider wrote:

> What is the relationship (supposed to be) between this standard and the JSON MIME type?  As far as I can tell they cover precisely the same ground, except for interoperability warnings and admonitions.
> 
> peter

I can't speak officially for TC39 but I can give you my personal interpretation of the discussions and consensus that lead to the release of Ecma-404.

JSON is used for many purposes.  All of those uses require at least two agreements between a producer and consumer of JSON text:

1) There must be agreement upon the syntactic structure of JSON text so it can consistently decomposed into its constituent elements. 

2) The must be agreement upon the semantic interpretation of the syntactic elements.

Ecma-404 address the first of these needs.  It specifies the JSON syntax structure for sequences of Unicode code points and nothing more.

In particular, it does not address any issues relating to the semantic interpretation of that syntactic structure.  This includes issues such as the maximum precision of a "JSON number" or even a mathematical interpretation of a JSON numbers.  Semantis also includes any meaning  associated with the "names" of JSON Object name/value pairs including issues of ordering or repetition.  Finally, there are likely to be many domain specific semantic issues  that may be loosely described as the "schema" of a particular JSON text.  The TC39 consensus was that there is no universal semantics that can be applied to all uses of JSON texts.  It is up to produces and consumers to agree upon a semantics.  Perhaps via ad hoc agreements or perhaps via other standards that address specific use cases.  TC39 currently has no plans to develop any additional standards at this semantic level.

There are other situational agreements that may be necessary in order to coordinate a producer and consumer of JSON text.

For example, Ecma-404 defines a syntax over unicode code points.  A producer and consumer may communicate in a manner that does not directly transfer such code points.  In that case, there needs to be agreement upon an transport encoding of JSON text.  Such encodings might place restrictions upon the JSON text it can deal with.  For example, it  might specify an UTF-8 encoding and refuse to encode JSON text that includes unmatched surrogates.  To me, this seems to be where the question of a JSON MIME type lives.  As far as far as I know, nobody has suggested that TC39 should issues a standard relating to this encoding level or concerning the JSON MIME type.  This seems like an appropriate subject area for the IETF.

Another area of coordination relates to the translation of JSON texts to/from language specific data structures.  Use of JSON does not require such a translation (a producer could just directly output syntactically valid JSON text and a consumer could take direct action as it parses a JSON text) but expectations and experience suggest this usage mode to be very common. Translation to/from a syntactically valid JSON text requires the specification of a mapping from the JSON syntactic elements specified in Ecma-404 to language specific data structures.  Such a translation is itself a semantics applied to the JSON syntax.  Like any semantics it may place restrictions on the JSON texts that it will accept or produce.  Ecma-262, the ECMAScript Language Specification, includes the definition of such a mapping of JSON text to ECMAScript language values.  The next edition of Ecma-262 will be updated to normatively reference Ecma-404.  It will continue to impose ECMAScript specific semantic restrictions such as the conversion of JSON number tokens to ECMAScript Number values and a specific interpretation of repeated names within a JSON object.   Ecma-262 doesn't say that this is the only way to translate a JSON text into ECMAScript language values. It simply defines the translation behavior that is provided by the standard ECMAScipt library. Other languages are likely to define there own mappings to/from JSON text.

TC39 internally agreed that the foundation for the use of JSON is the syntactic structure of JSON text and that is the purpose of Ecma-404. There was no consensus (and minimal discussion) concerning encoding or semantic issues (other than the Ecma-262 mapping) or even a consensus on the need/desirability of a single standard addressing semanitic issues.  TC39 is not currently working on additional standards that address those areas and I doubt that this will change in the near future.  If a need emerges addressing a specific use case or application domain that fits within the TC39 charter (just as an example,  using JSON to encode ECMAScript debugging information) then we might start an activity in that area.

Allen







 
Received on Tuesday, 8 October 2013 19:38:20 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:33:21 UTC