數據這是我的JSON文件:檢索的NSDictionary
{"object":
{"blog":[{"guid":181,"type":"object","subtype":"4","time_created":"1376731708","time_updated":"1376731708","container_guid":"180","owner_guid":"180","site_guid":"1","title":"ugg sito ufficiale italiavyt","description":"sdataa","url":"http:\urlt"}],
"bookmarks":[
{"guid":82,"type":"object","subtype":"9","time_created":"1372072736","time_updated":"1372072910","container_guid":"81","owner_guid":"33","site_guid":"1","title":"Eqtitler","description":"<description>","url":"http:\urler"},
{"guid":75,"type":"object","subtype":"9","time_created":"1371728924","time_updated":"1371728924","container_guid":"64","owner_guid":"52","site_guid":"1","title":"Ttitleur","description":"<pdescriptionp>","url":"http:\urlr"}
]
},
"group":[
[
{"guid":83,"type":"group","subtype":"0","time_created":"1372073952","time_updated":"1372074727","container_guid":"33","owner_guid":"33","site_guid":"1","name":"titles","description":"description>","url":"http:\urls"},
{"guid":81,"type":"group","subtype":"0","time_created":"1372067304","time_updated":"1372068113","container_guid":"33","owner_guid":"33","site_guid":"1","name":"titles","description":"<pdescriptionp>","url":"http:\/\urles"},
{"guid":64,"type":"group","subtype":"0","time_created":"1371728148","time_updated":"1372068044","container_guid":"33","owner_guid":"33","site_guid":"1","name":"Gtitres","description":"<description>","url":"http:\/\urls"}
]
]
}
我用下面的代碼來解析的json:
NSError *error = nil;
NSData *jsonData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://s210678217.onlinehome.fr/?view=json"]];
id jsonObjects = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error];
NSDictionary *feed = [jsonObjects objectForKey:@"object"];
NSArray *entries = [feed objectForKey:@"bookmarks"];
或者
NSArray *entries2 = [feed objectForKey:@"blog"];
此代碼工作完全檢索數據與書籤和博客。 只有這個代碼不能檢索組。 我不明白爲什麼?