string url ="http://api.map.baidu.com/telematics/v3/weather?location=昌图&output=json&ak=************";
WebClient wc =newWebClient();
wc.Encoding=Encoding.UTF8;
var txt = wc.DownloadString(url);
var xx =JsonConvert.DeserializeObject<BaiduWeather>(txt);
publicclassIndex
{
publicstringTitle{ get;set;}
publicstringZs{ get;set;}
publicstringTipt{ get;set;}
publicstringDes{ get;set;}
}
publicclassWeather_data
{
publicstringDate{ get;set;}
publicstringDayPictureUrl{ get;set;}
publicstringNightPictureUrl{ get;set;}
publicstringWeather{ get;set;}
publicstringWind{ get;set;}
publicstringTemperature{ get;set;}
}
publicclassResults
{
publicstringCurrentCity{ get;set;}
publicstringPm25{ get;set;}
publicList<Index>Index{ get;set;}
publicList<Weather_data>Weather_data{ get;set;}
}
publicclassBaiduWeather
{
publicintError{ get;set;}
publicstringStatus{ get;set;}
publicDateTimeDate{ get;set;}
publicList<Results>Results{ get;set;}
}
posted @
2017-06-04 10:08
开发软件
阅读(
1048)
评论()
编辑
收藏
举报