我想解析 Weather API (URL) 城市名称、温度等。
我的 JSON 数据如下:
{
"data": {
"current_condition": [{
"cloudcover": "25",
"humidity": "70",
"observation_time": "04:21 PM",
"precipMM": "0.3",
"pressure": "1007",
"temp_C": "30",
"temp_F": "86",
"visibility": "4",
"weatherCode": "113",
"weatherDesc": [{
"value": "Clear"}],
"weatherIconUrl": [{
"value": "http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0008_clear_sky_night.png"}],
"winddir16Point": "S",
"winddirDegree": "180",
"windspeedKmph": "7",
"windspeedMiles": "4"}],
"request": [{
"query": "Ahmedabad, India",
"type": "City"}],
"weather": [{
"date": "2012-09-18",
"precipMM": "2.1",
"tempMaxC": "32",
"tempMaxF": "89",
"tempMinC": "25",
"tempMinF": "76",
"weatherCode": "176",
"weatherDesc": [{
"value": "Patchy rain nearby"}],
"weatherIconUrl": [{
"value": "http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0009_light_rain_showers.png"}],
"winddir16Point": "SSW",
"winddirDegree": "203",
"winddirection": "SSW",
"windspeedKmph": "12",
"windspeedMiles": "8"},
{
"date": "2012-09-19",
"precipMM": "3.4",
"tempMaxC": "32",
"tempMaxF": "89",
"tempMinC": "25",
"tempMinF": "76",
"weatherCode": "176",
"weatherDesc": [{
"value": "Patchy rain nearby"}],
"weatherIconUrl": [{
"value": "http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0009_light_rain_showers.png"}],
"winddir16Point": "SW",
"winddirDegree": "223",
"winddirection": "SW",
"windspeedKmph": "12",
"windspeedMiles": "7"}]
}
}
如何解析这些数据并获取城市名称和温度..我不知道..提前谢谢。
===============输出========================
我想获取这样的数据并在文本框上设置
Date 2012-09-18 2012-09-19
tempMaxC 32 32
tempMinC 25 25
tempMaxF 89 89
tempMinF 76 76