ios - NSDictionary - Parsing item out of a return JSON service -
i'm trying work web service mad stuff. part of service returning value looks screen shot.
below code trying loop through nsdictionary.
nsdictionary *platesjson = [nsjsonserialization jsonobjectwithdata:data options:kniloptions error:nil]; for(id key in platesjson) { id myvalue = [platesjson objectforkey:key]; nsstring *myvalue = [[platesjson objectforkey:key] objectforkey:@"value"]; }
i have tried looping on dictionary of arrays , pulling out information yet seems return nil or crash entirely. ironically screen shot value of 0 error web service i'm trying put if condition around.
i have tried following resulting nil well;
for (int = 0; i< platesjson; i++) { nsstring *myvalue = [[platesjson objectatindex:i] objectforkey:@"value"]; } if(myvalue == 0){ //alert user no data found } else{ //continue on.... }
i'm sure simple stuck best way approach correct syntax.
nsdictionary *platesjson = [nsjsonserialization jsonobjectwithdata:data options:kniloptions error:nil]; for(id key in platesjson) { id myvalue = [platesjson objectforkey:key]; nsstring *myvalue = [platesjson objectforkey:key]; }
i guess work,
[platesjson objectforkey:key]
will value. if value dictionary,you need loop in again. in image post, simple dictionary
Comments
Post a Comment