我试图解析一个YouTube播放列表:iOS 5谷歌JSON - 如何解析嵌套的对象?
如果我的JSON的结构类似:
{"apiVersion" ....
"items":[{"id2":"some-id","title":"songtitle",
我完全能够通过解析标题:
// Fill array
NSArray *items = [json objectForKey:@"items"];
// Get item from tableData
NSDictionary *item = [tableData objectAtIndex:[indexPath row]];
// Set text on textLabel
[[cell textLabel] setText:[item objectForKey:@"title"]];
但如果JSON是这样的:
{"apiVersion" ....
"items":[{"id1": .... "video":{"id2":"some-id","title":"songtitle",
我怎样才能达到嵌套目标ct标题?
只是一个简单的事情,但我现在敲我的头在这几个小时。感到沮丧,谢谢你的建议!
[编辑] 这是一个完整的结构:
{
"items":
[
{
"video":
{
"title": "Number One",
"description": "Description one"
},
{
"title": "Number two",
"description": "Description two"
},
{
"title": "Number three",
"description": "Description three"
}
},
{
"video":
{
"title": "Number One",
"description": "Description one"
},
{
"title": "Number two",
"description": "Description two"
},
{
"title": "Number three",
"description": "Description three"
}
}
]
}
你能证明你的整个JSON ,它有点混淆这种方式... – 2012-04-24 12:41:48