日期:2014-05-17 浏览次数:20843 次
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
// 查询天气
//{"weatherinfo":{"city":"北京","cityid":"101010100","temp1":"22℃","temp2":"10℃","weather":"晴转多云","img1":"d0.gif","img2":"n1.gif","ptime":"08:00"}}
string jsonString =WebUIHelper.HttpGet("http://www.weather.com.cn/data/cityinfo/101180801.html", null);
JObject rss = JObject.Parse(jsonString);
string city = (string)rss["weatherinfo"]["city"];
string temp1 = (string)rss["weatherinfo"]["temp1"];
string temp2 = (string)rss["weatherinfo"]["temp2"];
string weather = (string)rss["weatherinfo"]["weather"];
LabelCity.Text = city;
LabelTemp1.Text = temp1;
LabelTemp2.Text = temp2;
LabelWeather.Text = weather;