You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. put key value in linkedHashMap in a specific order
2. output json data on client in ajax response
3. order is not preserved
Map<String, String> obj=new LinkedHashMap<String, String>();
for (String id : runTimes.keySet()) {
obj.put(id, runTimes.get(id));
}
String jsonString = JSONValue.toJSONString(obj);
resp.setContentType("application/json; charset=utf-8");
PrintWriter out = resp.getWriter();
log.debug("pricing runtimes json: " +jsonString );
out.println(jsonString );
out.flush();
out.close();
expected:
pricing runtimes json: {"19":"09\/05\/2013 02:55 PM","18":"09\/05\/2013 02:09
PM","16":"08\/29\/2013 02:49 PM"}
What is the expected output? What do you see instead?
The order is out put correctly in java but when the json data is returned to
the client, the order has been resorted.
in ajax response:
Object {16: "08/29/2013 02:49 PM", 18: "09/05/2013 02:09 PM", 19: "09/05/2013
02:55 PM"}
What version of the product are you using? On what operating system?
Please provide any additional information below.
Original issue reported on code.google.com by [email protected] on 16 Sep 2013 at 12:26
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 16 Sep 2013 at 12:26The text was updated successfully, but these errors were encountered: