我是 iphone 和 json 世界的新手。我有这个 json 结构。你可以把它放在这里http://jsonviewer.stack.hu/看清楚。
{"@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 中?但我不知道如何:/而且我不知道对象的数量是可变的。请帮忙 。