JSON Parse objective c
I´ve got the next json code:
{
"person_1":{
"name" :"person",
"pictures":[
{"images":{
"picture_1": "url1",
"picture_2": "url1",
}
}
],
}
}
Can anyb开发者_Go百科ody tell me how to get the element "picture_1"? I am using touchJson for objective c.
Best Regards
First, I would recommend using yajl as I found it very convenient for my work.
NSBundle * personBundle = [[yourstring yajl_JSON] valueForKey:@"person_1"];
NSArray * picturArray = [personBundle valueForKey:"pictures"];
NSBundle * imagesBundle = [picturArray objectAtIndex:0];
NSString * myUrl = [imagesBundle valueForKey:"picture_1"];
This should pretty much do it.
精彩评论