iphone - Parse JSON link in Objective C -
i`m building app ipad. can give me advice on how parse json link in objective c, can image (media_655fa.png) "item_media"? example code:
{ "id":"6", "item_type":"page", item_name":"intro_page", "item_media":"http:\/\/demo.test.biz\/test\/var\/uploads\/default_item\/media_655fa.png", "item_text":"" }
or, if has advice on how it. problem in link php sends json_encode()
. how can in objective c json_decode
or regexp
in php?
you can parse json :
// ***************** fetching data ******************* // nsurl *url = [nsurl urlwithstring:[nsstring stringwithformat:@"%@",siteapiurl]]; nsdata *data= [nsdata datawithcontentsofurl:url]; if (data == nil) { return; } nserror* error; nsmutabledictionary *jsonis = [nsjsonserialization jsonobjectwithdata:data options:kniloptions error:&error]; // nslog(@"json : %@",jsonis); if (jsonis != nil) { nsstring *item_media = [jsonis objectforkey:@"item_media"]; }
here item_media
image link.
hope helps you.
Comments
Post a Comment