esthervidal78 / json-smart

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

JSONObject should use LinkedHashMap instead of HashMap #36

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I'm using this in conjunction with JsonPath and I have been debugging my 
problem for a while.  The issue is that the order I get the keys back changes 
between generation of the JSON and parsing of the JSON as the JSONObject is 
backed by a HashMap.  Hence if I build a structure, serialize and deserialize, 
I don't actually have the same structure.

Original issue reported on code.google.com by karldmo...@gmail.com on 1 Mar 2013 at 12:32

GoogleCodeExporter commented 8 years ago
LinkedHashMap is not the default parent for speed optimisation reason.

LinkedHashMap can be use by calling directely JSONParser.

ie:
JSONParser p = new JSONParser(MODE_RFC4627);
p.parse("{'my':'json'}", ContainerFactory.FACTORY_ORDERED);

Original comment by uriel.chemouni on 2 Apr 2013 at 6:16

GoogleCodeExporter commented 8 years ago
Thanks, I'll look at patching JsonPath instead.

Original comment by karldmo...@gmail.com on 11 Apr 2013 at 3:23

GoogleCodeExporter commented 8 years ago

Original comment by uriel.chemouni on 15 May 2013 at 9:19