objective c - Parse world weather online JSON with ObjectiveC for iOS 6 -


i need suggestion: i've json downloaded http://www.worldweatheronline.com/free-weather.aspx. i've issue parse json:

{    "data":{       "current_condition":[          {             "cloudcover":"0",             "humidity":"57",             "observation_time":"07:23 pm",             "precipmm":"0.0",             "pressure":"1013",             "temp_c":"23",             "temp_f":"73",             "visibility":"10",             "weathercode":"113",             "weatherdesc":[                {                   "value":"clear"                }             ],             "weathericonurl":[                {                   "value":"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0008_clear_sky_night.png"                }             ],             "winddir16point":"w",             "winddirdegree":"275",             "windspeedkmph":"0",             "windspeedmiles":"0"          }       ],       "request":[          {             "query":"roma, italy",             "type":"city"          }       ],       "weather":[          {             "date":"2013-05-04",             "precipmm":"0.0",             "tempmaxc":"26",             "tempmaxf":"78",             "tempminc":"13",             "tempminf":"55",             "weathercode":"113",             "weatherdesc":[                {                   "value":"sunny"                }             ],             "weathericonurl":[                {                   "value":"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0001_sunny.png"                }             ],             "winddir16point":"wsw",             "winddirdegree":"251",             "winddirection":"wsw",             "windspeedkmph":"9",             "windspeedmiles":"6"          }       ]    } } 

from json need 3 info: tempmaxc, tempminc , weathericonurl --> value. until made method:

- (void)wheaterdidfinish:(nsdictionary*)object {     if (object) {         nsdictionary *obj = [object objectforkey:@"data"];         nsarray *firstzero = [obj objectforkey:@"weather"];         nslog(@"%@ e %d", firstzero, firstzero.count);      } } 

how can obtain info need? can me? thank you

-(void)wheaterdidfinish:(nsdictionary*)object  {     nsstring *tempmaxc=@"" , tempminc =@"" , weathericonurl =@"";      if (object)      {          nsdictionary *obj = [object objectforkey:@"data"];           nsarray *firstzero = [obj objectforkey:@"weather"];           nsmutabledictionary *weatherdict = [firstzero objectatindex:0];           tempmaxc = [nsstring stringwithformat:@"%@",[weatherdict objectforkey:@"tempmaxc"]];           tempminc = [nsstring stringwithformat:@"%@",[weatherdict objectforkey:@"tempminc"]];           nsarray *weathericonarray=[weatherdict objectforkey:@"weathericonurl"];           weathericonurl = [nsstring stringwithformat:@"%@",[[weathericonarray objectatindex:0] objectforkey:@"value"]];      } } 

this solve problem


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -