这就是内容......
[
{
"id": "",
"title": "",
"website": "",
"categories": [
{
"id": "",
"label": ""
}
],
"updated":
},
{
"id": "",
"title": "",
"website": "",
"categories": [
{
"id": "",
"label": ""
}
],
"updated":
}
]
如何将每个Feed源插入一个阵列?
NSDictionary *results = [string JSONValue];
NSArray *subs = [results valueForKey:@"KEY"];
我必须插入哪个键? 感谢
答案 0 :(得分:2)
因为我可以看到你的结构,你将摆脱这个JSON-String
NSArray:
[
NSDictionary:
{
NSString: "id",
NSString: "title",
NSString: "website",
NSArray: "categories":
[
NSDictionary:
{
NSString: "id",
NSString: "label"
}
],
NSNumber: "updated"
},
NSDictionary:
{
...
}
]
所以你已经在root上有一个“Feeds”数组,你必须用数组中的索引来对它们进行迭代。对于第一个ID,即[[myJsonStructure objectAtIndex:0] objectForKey:@"id"];