I understand that a JSONObject contains key-value pairs that are not ordered. But, at what point does a JSONObject change its order? For instance, if I have a JSONObject such as
{"p1": 1, "p2": 2}
Will it become unordered if I don't modify it?
I understand that a JSONObject contains key-value pairs that are not ordered. But, at what point does a JSONObject change its order? For instance, if I have a JSONObject such as
{"p1": 1, "p2": 2}
Will it become unordered if I don't modify it?
If you want to preserve the order predicted by insertion use :
JSONObject object = new JSONObject(new LinkedHashMap());