我正在尝试解析以下 JSon(我认为上次检查时已验证):
{
"top_level" = (
{
"download" = "http:/target.com/some.zip";
"other_information" = "other info";
"notes" = (
{
obj1 = "some text";
obj2 = "more notes";
obj3 = "some more text still";
}
);
title = "name_of_object1";
},
{
"download" = "http:/target.com/some.zip";
"other_information" = "other info";
"notes" = (
{
obj1 = "some text";
obj2 = "more notes";
obj3 = "some more text still";
}
);
title = "name_of_object2";
},
{
"download" = "http:/target.com/some.zip";
"other_information" = "other info";
"notes" = (
{
obj1 = "some text";
obj2 = "more notes";
obj3 = "some more text still";
}
);
title = "name_of_object3";
}
);
}
我的尝试是使用以下内容:
NSDictionary *myParsedJson = [myRawJson JSONValue];
for(id key in myParsedJson) {
NSString *value = [myParsedJson objectForKey:key];
NSLog(value);
}
错误:
-[__NSArrayM length]: unrecognized selector sent to instance 0x6bb7b40
问题: 在我看来,JSon 值使 myParsedJson 对象成为 NSArray 而不是 NSDictionary。
我将如何遍历名为 name_of_object 的对象并访问每个嵌套字典?我会以正确的方式去做吗?