« Return to Thread: JSON parser grammar

Re: JSON parser grammar

by Robert Sayre-2 :: Rate this Message:

Reply to Author | View in Thread

On Wed, Jun 3, 2009 at 1:27 AM, Allen Wirfs-Brock
<Allen.Wirfs-Brock@...> wrote:
>
> The intent was for the ES5 JSON grammar to exactly match the JSON RFC grammar.  If you think it is different, then you may have found a bug so let's make sure...

It definitely doesn't match, on purpose. For example, the RFC requires
JSON strings to represent objects (or arrays) at the root, no
primitives allowed.

>
> Examples, please? The intent is that applying JSON.parse to a string containing a valid JSON form should produce an equivalent set of objects on all conforming ES5 implementation.

JSON.parse("[010]")

should be an error, per spec. Nobody follows the spec though...


--

Robert Sayre

"I would have written a shorter letter, but I did not have the time."
_______________________________________________
es-discuss mailing list
es-discuss@...
https://mail.mozilla.org/listinfo/es-discuss

 « Return to Thread: JSON parser grammar