我是iphone和json世界的新手。我有这个JSON结构。你可以在这里把它看得很清楚http://jsonviewer.stack.hu/。解析json的麻烦
{"@uri":"http://localhost:8080/RESTful/resources/prom/","promotion":[{"@uri":"http://localhost:8080/RESTful/resources/prom/1/","descrip":"description
here","keyid":"1","name":"The first
name bla bla
","url":"http://localhost/10.png"},{"@uri":"http://localhost:8080/RESTful/resources/promo/2/","descrip":"description
here","keyid":"2","name":"hello","url":"http://localhost/11.png"}]}
我想用json-framework解析它。我试过这个
NSDictionary *json = [myJSON JSONValue];
NSDictionary *promotionDic = [json objectForKey:@"promotion"];
NSLog(@" res %@ : ",[promotionDic objectAtIndex:0]);
但是怎么做才能得到例子,索引0的对象的名字?我想我应该把对象放在NSArray中?但我不知道如何:/和我不对象的数量是可变的。请帮助 。
谢谢你,它的工作:) – user761812 2011-05-22 19:13:12