kahntang / as3corelib

Automatically exported from code.google.com/p/as3corelib
0 stars 0 forks source link

Issue decoding JSON strings created from Javascript #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Trying to deserialize following JSON string generated from javscript but
getting parsing error.
[{BookTitle:"JSON", Name:"Mat"}]

But folloing JSON string can be serialized successfully:
[{"BookTitle":"JSON", "Name":"Mat"}]

Original issue reported on code.google.com by dinny.ma...@gmail.com on 22 Feb 2007 at 4:29

GoogleCodeExporter commented 9 years ago
This may have been fixed by

http://code.google.com/p/as3corelib/issues/detail?id=2&can=1&q=

which is going into the .9 build.

Dinny, can you pull the source and see if that fixes the issue?

Original comment by mikechambers on 3 Mar 2007 at 9:08

GoogleCodeExporter commented 9 years ago
This isn't a bug -- the original JSON string that you're trying to use -
[{BookTitle:"JSON", Name:"Mat"}] - is not correctly formatted JSON code.

From json.org, an Object consists of pairs, where each pair is string:value.  
The
identifier on the left of the pair then, being a string, needs to be enclosed 
in quotes.

Whatever library your using to generate the JSON string is not producing
JSON-compliant output.  Make sure that the name part of the name/value pairs 
inside
of an object is getting correctly wrapped in quotes.

Original comment by darron.schall on 20 Mar 2007 at 11:02