cymhappy / as3corelib

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

JSON doesn't recognize UINT (0x123456) as a number #41

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a json string that contains a key:val like {"myNumber":0xFF1100}
2.
3.

What is the expected output? What do you see instead?
Should get the value (16716032), but parser throws an error "Unexpected 'x'
encountered'

What version of the product are you using? On what operating system?
corelib v.9

Please provide any additional information below.
I have provided a fix (lines 340-352, 538-547) in JSONTokenizer.as. See
attached.

Original issue reported on code.google.com by Ke...@KevinFauth.com on 18 Sep 2007 at 11:13

Attachments:

GoogleCodeExporter commented 9 years ago

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

GoogleCodeExporter commented 9 years ago
It's not valid JSON for numbers to be in hex format (note the "Number" section 
on
http://www.json.org/).  However, this is a good candidate as something to allow 
in a
"non-strict" mode for decoding.

So, in strict mode, this is a parse error.  In non-strict mode, we should 
convert hex
format into numbers.

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

GoogleCodeExporter commented 9 years ago
In revision 63 - http://code.google.com/p/as3corelib/source/detail?r=63 - Added 
code
to recognize hex digit numbers.  Commented out for now until "strict" mode flag 
is
added (since this is a feature that is not part of the official spec).

Once we create a "strict" flag we can finish this up (and add the flag to the 
test as
well as to the conditional in the tokenizer)

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

GoogleCodeExporter commented 9 years ago

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

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