I need to be able to create a new JSONArray from the one I already have, in the array I have a whole lot of fields called id, another one on each line, how do I get a list of them?
eg. I get this back
[{"id":111,"users":"blob"},
{"id":111,"users":"blob"},
{"id":111,"users":"blob"},
{"id":111,"users":"blob"},
{"id":111,"users":"blob"},
{"id":111,"users":"blob"}]
How would I get a list of just the ID's ?
- Edit
Decided to use a for loop straight after this but thanks :D
HttpResponse response = httpclient.execute(httpget); //execute the HttpPost request
JSONArray jsa = projectResponse(response); //get the json response
for(int i = 0; i < jsa.length(); i++){
JSONObject jso = jsa.getJSONObject(i);
publishProgress(jso.getString("id"), jso.getString("name"));
}
JSONArray
with a good 'ol fashionedfor
loop? – Travis Webb Apr 19 '12 at 2:23