日期:2014-05-17  浏览次数:20843 次

请问下面的json我怎么解析
{"head":{"msgtype":1,"result":0,"resultmsg":null},"person":[{"client":0,"id":0,"
nickname":null,"password":"zpq","username":"zpq"}]}
{"head":{"msgtype":1,"result":0,"resultmsg":null},"remind":[{"id":0,"content":"hi all"}]}

就是说项目中所有的json格式都是以head开头,然后嵌入其它的实体类,单独解析我已经会了,我只想获得msgtype的值然后在去调用解析的方法,请问我怎么获得msgtype的值,即是说传过来的json我只想解析head获得msgtype值后再去解析 
只有20分了 谢谢
json c#

------解决方案--------------------
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;