-1
我需要一個建議:我從這個http://www.worldweatheronline.com/free-weather.aspx下載了JSON。我有問題解析這個JSON:用ObjectiveC解析世界天氣在線JSON iOS 6
{
"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"
}
]
}
}
從這個JSON我需要3個信息:tempMaxC,tempMinC和weatherIconUrl - >值。到現在爲止,我做了這個方法:
- (void)wheaterDidFinish:(NSDictionary*)object {
if (object) {
NSDictionary *obj = [object objectForKey:@"data"];
NSArray *firstZero = [obj objectForKey:@"weather"];
NSLog(@"%@ e %d", firstZero, firstZero.count);
}
}
我如何獲得我需要的信息?你可以幫我嗎? 謝謝
謝謝!我試過了,效果很好! – lucgian841 2013-05-04 20:36:59
最受歡迎:) – 2013-05-04 20:38:16