Hey, Im trying to parse the following JSON data:
{"chat":
{"link":
[{"@rel":"next","@ref":"http"}],
"events":
{"link2":
[{"@rel":"next","@ref":"http"}]}
}}
The code that reads the data is (where 'a' is the JSON as String):
JSONObject jsonObject1 = new JSONObject(a);
JSONObject jsonObject = jsonObject1.getJSONObject("chat");
So the structure (at least the way I intended) is:
<chat>
<link>
<events>
<link2>
</events>
</chat<
But, after getJsonObject("chat"), jsonObject equals to:
{"chat":{"events":{"link2":[{"@ref":"http","@rel":"next"}]},"link":[{"@ref":"http","@rel":"next"}]}}
What am I missing? Why does the data flips and the structure changes?