ios - converting a NSString with JSON to NSDictionary -
i have nsstring
looks like:
{ "name": "anevent", "args": [ { "ct": "un", "someuuid": "d7ec06de-98d3-436f-a657-fb043567fb67", "username": "joe smith", "long": "-139.724302", "lat": "39.402768" } ] }
how can inner part
{ "ct": "un", "someuuid": "d7ec06de-98d3-436f-a657-fb04383cfb67", "username": "joe smith", "long": "-139.724305", "lat": "39.402768" }
into nsdictionary
?
thanks.
try code:
nsdictionary *dictobj = [nsjsonserialization jsonobjectwithdata:[yourstring datausingencoding:nsutf8stringencoding] options:nsjsonreadingmutablecontainers error:nil]; nsdictionary *requiredobject = [[dictobj objectforkey:@"args"] objectatindex:0];
Comments
Post a Comment