| 返回结果 |
返回结果为JSON格式。相比较XML,JSON数据冗余少解析快。关于如何解析JSON,请参考 http://www.json.org/json-zh.html
{
"Stat": "OK", //错误信息。正常返回时值为"OK"。
"Weathers": [{ //城市天气数组。同时查询多个城市时,该数组则包含多个对象。
"CityId": "101010100", //城市ID
"CityName": "北京", //城市名
"Country": "CH", //国家。仅数据源为yahoo时有效。
"Current": { //实时天气信息
"Chill": "5", //当前实时体感温度
"Code": "20", //天气图标代码 (查看说明)
"Direction": "北", //风向
"Humidity": "93", //湿度。单位:百分比%。
"Index": null, //生活指数。目前不对API接口开放。
"Pressure": "1015.92", //气压。单位:百帕hPa。
"Rising": "1", //气压变化。0或steady为稳定,1或rising为升高,2或falling为降低。
"Speed": "3.22", //风速。单位:km/h。
"Sunrise": "6:58 am", //日出时间。
"Sunset": "4:56 pm", //日落时间。
"Temperature": "5", //当前实时温度
"Text": "雾", //天气情况
"Visibility": "3.49" //能见度。单位:公里km。
},
"Forecast": [{ //天气预报数组。smart和cma返回6天预报,msn返回5天预报,yahoo返回2天预报。
"Code": "31", //天气图标代码
"Cop": "20%", //降水概率。
"Date": "\/Date(1321371000000+0800)\/", //日期
"Day": "周二", //星期
"Extra": null, //无效字段
"High": "11", //最高温度
"Info": null, //无效字段
"Link": null, //无效字段
"Low": "1", //最低温度
"Text": "晴" //天气情况
}, { //第二天天气预报
"Code": "30",
"Cop": null,
"Date": "\/Date(1321457400000+0800)\/",
"Day": "周三",
"Extra": null,
"High": "14",
"Info": null,
"Link": null,
"Low": "5",
"Text": "晴间多云"
}],
"LastBuildDate": "11\/15\/2011 11:30:00 PM", //数据更新时间
"Region": "" //地区。一般不用。
}]
}
|