JSON parser grammar
Hallvord R. M. Steen
hallvord at opera.com
Fri Jul 3 15:41:47 PDT 2009
On Wed, 03 Jun 2009 21:42:46 +0200, Allen Wirfs-Brock <Allen.Wirfs-Brock at microsoft.com> wrote:
> a) Allow strings, numbers, Booleans, and null in addition to objects and
> arrays as top level JSON text.
> The ES5 spec. already has this although it isn't in the RFC. I haven't
> heard any suggestions that we remove it.
This may be a stupid question, but..
How can you allow "strings" as top level JSON text and keep the 15.12.2 step 2 requirement that JSON.parse() must throw if the input isn't valid JSON source text? In other words, how is an implementation supposed to know if I'm passing in a string of random content that should be "parsed" into a string or a malformed piece of JSON that should cause an exception?
--
Hallvord R. M. Steen, Core Tester, Opera Software
http://www.opera.com http://my.opera.com/hallvors/
More information about the es-discuss
mailing list