JSON parser grammar

Allen Wirfs-Brock Allen.Wirfs-Brock at microsoft.com
Thu Jun 4 08:24:08 PDT 2009


>-----Original Message-----
>From: Mark S. Miller [mailto:erights at google.com]
>
>Even at this late date, I think this change to the spec is called for.
>I agree we should change the Quote algorithm so that JSON.stringify
>does not generate unescaped <LS> or <PS> characters. JSON.parse would
>still accept them of course, and so the language accepted by
>JSON.parse (full JSON <value>) would not be a subset of ES5
><expression>. But with this change, the subset of JSON <value> emitted
>by JSON.stringify would also be a subset of ES5 <expression>. Small
>cost with high payoff.
>

We could validly decide to escape every character in a JSON string literals :-)

Seriously, since this is just an encoding choice that is consistent with the JSON RFC I don't have any real objections if there is a consensus that this is what we want to do.  However, the more late changes like this me make, the harder it is to achieve timely identical behavior between early implementations. 

I'm not as convinced that the actual payoff on this is all that high, but as you say the cost is not very high (at least in regards to spec. work, the cost to implementations and conformance may not be so low...)

Allen


More information about the es5-discuss mailing list