Reputation: 480
how to parse only this type of json arrary
[{'name':'john', 'age': 44}, {'name':'Alex','age':11}]
where i can't do something like this:
JSONArray DataListArray = jObject.getJSONArray("???");
Upvotes: 0
Views: 960
Reputation: 221997
The string like
[{'name':'john', 'age': 44}, {'name':'Alex','age':11}]
is wrong JSON. You can validate JSON here. Correct will be
[{"name":"john", "age": 44}, {"name":"Alex","age":11}]
Upvotes: 1
Reputation: 12365
You can use the string to initialize the JSON array.
String json = "[{'name':'john', 'age': 44}, {'name':'Alex','age':11}]";
JSONArray json = new JSONArray(json);
Upvotes: 2