Reputation: 177
I have a serialized json string in the format:
"[{\"Version\":\"8.63\",\"Date\":\"07\/11\/2011 00:00:00\",\"Count\":213},
{\"Version\":\"1.0\",\"Date\":\"07\/11\/2011 00:00:00\",\"Count\":1},
.........
,{\"Version\":\"7.7\",\"Date\":\"31\/10\/2011 00:00:00\",\"Count\":0}]"
I want to break down this string into an array of jsonObjects. I know if you have a string containing only one jsonObject then we can easily create a jsonObject.
Any help would be appreciated,
Thanks
Upvotes: 0
Views: 1465
Reputation: 5208
If you really want an array of JSONObjects and not a JSONArray you can do this this way:
JSONArray array = new JSONArray(string);
JSONObject[] objects = new JSONObject[array.length()];
for(int i = 0; i < array.length(); i++) {
objects[i] = array.getJSONObject(i);
}
Upvotes: 2