JSON parser grammar

David-Sarah Hopwood david-sarah at jacaranda.org
Mon Jun 8 17:35:43 PDT 2009


Allen Wirfs-Brock wrote:
> Conforming consensus...
> 
> I want to make sure that I understand the consensus of last week's discussion
> on this thread so I can update the spec. accordingly.  Below is the decision
> points that I sent out last week.  I've annotated it with what I believe was
> the consensus of the discussion.  Let me know if anybody disagrees that this
> is actually the consensus conclusions.

I agree with all of your annotations. (I gave in on allowing unquoted
property names.)

[...]
> In addition of code units in the range 0x0000-0x001f JSON.stringify inserts
> escape sequences into string literals for some or all of the following code units: 
> 0x007f-0x009f, 0x00ad, 0x0600-0x0604,0x070f,0x17bf,0x17b5,0x200c-0x200f,
> 0x2028-0x202f,0x2060-0x206f,0xfeff,0xfff0-0xffff
> 
> Was there any consensus that at least some of these code points

code units

> should be escaped? If show which if not all?

U+0604, which is unassigned, does not need to be in this list.

It is desirable for all of the other code units on the list to be escaped,
because they are all code units that are rejected in JS source by some
implementations, and therefore escaping them improves interoperability
with eval-based JSON parsers.

Another motivation for escaping U+2028 and U+2029 is to ensure that the
JSON produced by JSON.stringify is a subset of ES5 and ES3.

U+06DD and U+200B (format-control), and U+FDD0..FDEF (noncharacters) should
be added to the list. The rationale for adding them is the same as for the
other format-control characters and noncharacters.

-- 
David-Sarah Hopwood  ⚥  http://davidsarah.livejournal.com



More information about the es5-discuss mailing list