开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜