I'm trying to pass a map with int keys to UI in a json format.
I use LinkedHashMap
at the server side and compose it as follows:
{
3: "some value 3",
1: "some value 1",
2: "some value 2"
}
But when I check the coming object at the UI side I get the map sorted by key:
{
1: "some value 1",
2: "some value 2",
3: "some value 3"
}
I also tried to use a TreeMap
but is works in the same way.
I'm just wondering why the initial order has broken when using int keys whereas the order is preserved when uses not integer keys.