我有一個json集合我能夠完全精細地解析1級深度,但主集合中的每個項目都有一個集合。我不太知道如何訪問「項」,讓子集就像我與主要收集沒有...ios json解析子集合
NSString *response = [request responseString];
NSDictionary *json = [response JSONValue];
NSArray *items = [json valueForKeyPath:@"item"];
for (id item in items)
{
mainObject.name = [item objectForKey:@"name"]; //this works fine
// How do I get sub collection from item?
}
一些JSON的:
{"item":
{
"available_at" : null,
"created_at" : "2011-12-09T19:52:23Z",
"lo_id" : 30,
"id" : 24,
"merchant_id" : 1,
"order_id" : 25,
"reach_local_link" : null,
"status" : null,
"token" : "12-258847891-1",
"updated_at" : "2011-12-09T19:52:23Z",
"url" : "api/dir/v1/item/12-258847891-1/print",
"subitem1" :
{
"area" : "local",
"broker_id" : "",
"broker_id" : null,
"category" :
{
"category":....
在本例中,有可以是多個子項目,如subitem1。我需要獲取這些集合,並在當前的環境中有另一個for循環。
包含一點你的JSON看起來像 – Sam 2011-12-29 15:54:44
包括一些json – Jesse 2011-12-29 16:14:49