我在API请求后获取JSON数据。如何访问每个条目的值,例如"名称"和" 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"}}
(我使用的是Flash Player 11) 谢谢。 乌利
答案 0 :(得分:3)
var jsonObject:Object = JSON.parse(jsonString);
这将返回一个包含您数据的对象,因此如果您想访问名称,它将类似于:
for each(var data:Object in jsonObject.data)
{
trace(data.name);
}