When I serialize my LinkedHashMap<String, String> using GSON, I get
{"b":"a","a":"1","c":"2"}
and after deserializing I get back the elements in the right order. So everything works fine, but is there a guarantee that every tool works this way? Does the order of entries have any significance in JSON?
No, Javascript hashes do not necessarily have a consistent order. For that, you’d probably want a representation like
or store the key order in a separate list, depending on what you are doing with it.