Reputation: 2693
I'm getting JSON data after an API request. How to access the values of each entry, e.g. "name" and "id"?
{"data":[{"category":"Website","name":"Example","access_token":"1234","id":"1234,"perms":["ADMINISTER","EDIT_PROFILE","CREATE_CONTENT","MODERATE_CONTENT","CREATE_ADS","BASIC_ADMIN"]}],"paging":{"next":"https:\/\/graph.facebook.com\/1234\/accounts?
access_token=1234&limit=5000&offset=5000&__after_id=1234"}}
(I'm using Flash Player 11) Thank you. Uli
Upvotes: 2
Views: 1455
Reputation: 1234
var jsonObject:Object = JSON.parse(jsonString);
This will return an object with your data in it, so if you want to access name, it would be something like:
for each(var data:Object in jsonObject.data)
{
trace(data.name);
}
Upvotes: 3