I have a LinkedHashMap
with states.
Map<String, String> stateMap = new LinkedHashMap<String, String>();
// ...
I'm creating a JSONObject
based on it.
JSONObject json = new JSONObject();
json.putAll(stateMap);
However, the entries appear unordered. I'd like to preserve the ordering of LinkedHashMap
in JSONObject
. How can I achieve this?