On Jun 2, 2009, at 11:09 PM, Rob Sayre wrote:
On 6/3/09 1:56 AM, Allen Wirfs-Brock wrote:
My inclination would be to require ES5 implementation to exactly
conform the whatever JSON grammar we provide and to throw syntax
errors if the input doesn't exactly conform to the grammar. (in
other say that the section 16 extension allowance doesn't apply to
JSON.parse. If an implementation wants to support JSON syntax
extensions it could always do so by providing a JSON.parseExtended
function (or whatever they want to call it) that uses an
implementation defined grammar.
I could live with that. But since the ES5 grammar does not match the
RFC, and no one is shipping a fully conformant JSON.parse
implementation right now, we should consider whether we want to
allow or disallow each case that comes up. Mozilla has a few edge
cases that stem from RFC 4627, Section 4. [1]
1.) leading zeros are parsed as decimal numbers (octal seems like a
bug no matter what, per MarkM)
IE8 and V8's JSON implementation, and json2.js at json.org all
interpret 010, as octal (eg. 8), and 009 as 9
2.) trailing commas in objects and arrays are allowed ({"foo":
42,"bar":42,})
V8's JSON implementation also accepts [1,,,2]
3.) tabs and linebreaks are allowed in JSON strings (but
JSON.stringify produces escape sequences, per spec)
My testing shows that only '\' (excluding actual escape sequences) and
'"' are prohibited -- all other values from 0-0xFFFF are allowed.
--Oliver
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss