yixiaohui12345 / as3corelib

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

JSONDecoder needs to be more smart to parse #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Description:-

JSONDecoder class needs to be more smart to decode strings like this:-

[ { "ew" : "wahan", "hws" : [ "caa","sss", ] }, { "ew" : "aap", "hws" : [
"ss", ] }, ]

You can see, there is extra comma (,) in array and individual objects. I
know above example is result of logical-problem in JSON serialization, I
find it quite common and even some of Google API do that.

I patched the code so that it works even such cases. I am attaching bothing
the patch and changed file.

Expected:-

JSONDecoder should be able to parse improperly terminated strings as shown
above. Those are quite regular use-cases.

Actual:-

It throws ParseError when it encounters ] or } after comma (,) in an array
or object.

Original issue reported on code.google.com by abdul.qa...@gmail.com on 29 Aug 2007 at 8:51

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by mikechambers on 2 Jul 2008 at 4:32

GoogleCodeExporter commented 9 years ago
I think this should be rolled into a "strict" mode.  In strict mode we should 
adhere
directly to the specification, but when not in strict mode we should gracefully 
skip
over commas at the last item of an array / object

Original comment by darron.schall on 23 Oct 2008 at 1:31

GoogleCodeExporter commented 9 years ago

Original comment by darron.schall on 23 Oct 2008 at 1:32

GoogleCodeExporter commented 9 years ago

Original comment by darron.schall on 23 Oct 2008 at 2:15

GoogleCodeExporter commented 9 years ago

Original comment by mikechambers on 7 Nov 2008 at 7:28

GoogleCodeExporter commented 9 years ago
Fixed in r83

Original comment by darron.schall on 23 Dec 2008 at 3:14