//開始解析 排序
//引用ip
//using System.Web.Script.Serialization;字符串
JavaScriptSerializer js = new JavaScriptSerializer();
Dictionary<string, Object> oList = js.DeserializeObject("Json字符串") as Dictionary<string, Object>;
if (oList != null)
{
string strRet = "";
if (oList.ContainsKey("ret"))
{
strRet = oList["ret"].ToString();
}
if (strRet == "0")
{string
Dictionary<string, object> oDataList = oList["data"] as Dictionary<string, Object>;
object[] oItem_listData = oDataList["item_list"] as object[];it
if (oItem_listData != null)
{
System.Linq.IOrderedEnumerable<object> q = from a in oItem_listData orderby ((Dictionary<string, object>)a)["字段"].ToString() descending select a;//排序的io
foreach (var oObj in q)
{
Dictionary<string, object> oCountriesDataList = oObj as Dictionary<string, object>;object
//匹配到Json串的內容 同過實體依次賦值foreach
if (oCountriesDataList .ContainsKey("類型"))
{
類型= oCountriesDataList ["類型"].ToString();
}List
if (oCountriesDataList .ContainsKey("內容"))
{
內容= oCountriesDataList ["內容"].ToString();
}select
//若是 內容裏面 還有下一級別的話 則繼續往下面解析 Json
object[] DateList = oCountriesDataList ["內容"] as object[];
if (DateList != null)
{
System.Linq.IOrderedEnumerable<object> qp = from a in DateList orderby ((Dictionary<string, object>)a)["時間"].ToString() ascending select a;//時間排序
foreach (var oObj1 in qp)
{
Dictionary<string, object> LowesDataList = oObj1 as Dictionary<string, object>;//數據集合
//獲得裏面 對用的 內容
DateTime Date = DateTime.Parse(LowesDataList ["時間"].ToString()); //日期
//你的類 繼續賦值 add
} } } }