JSON5

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

JSON5

Mike Samuel
On Tue, Jul 11, 2017 at 12:14 AM, J Decker <[hidden email]> wrote:
> Since JSON is apparently part of the standard now, can JSON5 maybe be
> considered for addition?  It's a very slight change, and simplifies
> conversions.
>
>
> Why does JSON have quoted field names anyway (which I could understand if
> they included spaced).

To avoid intersecting the reserved identifier set in languages that
wanted to provide a JSON-like syntax for producing values that
serialize to JSON.

> I searched archives and only came up with this result....
>
> https://mail.mozilla.org/pipermail/es-discuss/2012-August/024479.html
>
>
> https://github.com/json5/json5
>
> https://github.com/json5/json5/blob/master/lib/json5.js
>
> (although I would like to see the keyword 'undefined' also allowed as a
> value) which is just an 8 line addition.

> Comments in JSON?  Wonderful!
> Unquoted field names? Wonderful!

I think ECMA-404 is the version referenced by the Ecmascript spec.
That says in the preamble
"""
Because it is so simple, it is not expected that the JSON grammar will
ever change. This gives JSON, as a foundational notation, tremendous
stability. JSON was first presented to the world at the JSON.org
website in 2001. JSON stands for JavaScript Object Notation.
"""
so you might find it tough to convince them, but if you can convince
them that JSON needs exactly one more null value and that C++ comments
are better than bash comments then updating JSON.parse shouldn't be
hard.

You could also go the iETF route and try to obsolete RFC 7159 and then
argue to TC39 that ECMA-404 should be dropped in favor of that.

Since people are listing things they'd like to see in the language.
I tried to convince Doug Crockford to allow NaN/Infinities in JSON but
he's philosophically opposed.
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Loading...