iphone JSON解析..我如何解析这个数据
问题描述:
这是nsmutablearray的打印屏幕。iphone JSON解析..我如何解析这个数据
这2409,2410,2412不是固定键。它动态地来了。
{
2409 = (
{
AltSelectionPrice = "2.00";
},
{
AltSelectionPrice = "3.00";
}
);
2410 = (
{
AltSelectionPrice = "7.00";
},
{
AltSelectionPrice = "0.00";
}
);
2412 = (
{
AltSelectionPrice = "0.00";
},
{
AltSelectionPrice = "9.00";
},
{
AltSelectionPrice = "5.00";
}
);
}
日Thnx提前。
答
我目前在我的工作电脑上运行Windows,因此无法发布确切的代码。但是你需要做的是获得数组中的字典。可能像下面:
NSDictionary* dict = [myMutableArray objectAtIndex:0];
,然后遍历键在词典:
for (id key in [dict keyEnumerator]) {
//use the key or get the object of that key using [dict objectForKey:key]
}
更新:我以为你是从JSON解析器收到此阵!