gcodeforks / json-smart

Automatically exported from code.google.com/p/json-smart
0 stars 0 forks source link

JSONValue.parse returns float instead of string with MAX_COMPRESSION #44

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am de-/serializing Java objects using JSON. The objects often contain a UUID 
identifier generated by a database or Java code. If using max compression if 
the UUID "looks" like a floating point number the parser generates wrong values.

Test code:
JSONArray array = (JSONArray) JSONValue.parse(json);
array.get(0).toString()

With MAX_COMPRESSION (uuid_child value is wrong)
Input JSON: 
[{uuid_child:58860611416142319131902418361e88,uuid_parent:563a5570932e409e9621e1
8e5a17d6a5}]
Parsed JSON: 
{"uuid_child":5.8860611416142319131902418361E+116,"uuid_parent":"563a5570932e409
e9621e18e5a17d6a5"}

With LT_COMPRESS works:
Input JSON: 
[{"uuid_child":"58860611416142319131902418361e88","uuid_parent":"563a5570932e409
e9621e18e5a17d6a5"}]
Parsed JSON: 
{"uuid_child":"58860611416142319131902418361e88","uuid_parent":"563a5570932e409e
9621e18e5a17d6a5"}902418361e88","uuid_parent":"563a5570932e409e9621e18e5a17d6a5"
}

This happens with the current stable release json-smart-1.2. Haven't tested 
other versions by now.

Original issue reported on code.google.com by bohn...@gmail.com on 19 Feb 2014 at 11:37

GoogleCodeExporter commented 9 years ago
Fixed in next release

a new TestUnit : TestInvalidNumber is now present to check this kind of bug

Original comment by uriel.chemouni on 5 Jun 2014 at 11:26

GoogleCodeExporter commented 9 years ago

Original comment by uriel.chemouni on 6 Jun 2014 at 7:38

GoogleCodeExporter commented 9 years ago
Version 2.0 is available on Maven.

Original comment by uriel.chemouni on 13 Aug 2014 at 9:15

GoogleCodeExporter commented 9 years ago
Version 2.0 is available on Maven.

Original comment by uriel.chemouni on 13 Aug 2014 at 9:15