// jsonArray.ToJson() 是json数组 根据指定 treatment_no 来进行排序
json字符串
[{
"treatment_type": "1",
"treatment_no": "42",
},
{
"treatment_type": "1",
"treatment_no": "45"
}
}]
JArray array = JArray.Parse(jsonArray.ToJson()); //JArray sortArrary = new JArray(array.OrderBy(obj => (string)obj["keyid"]));//升序 JArray sortArraryDes = new JArray(array.OrderByDescending(obj => (string)obj["treatment_no"]));//倒序 //Console.WriteLine(sortArrary.ToString(Formatting.Indented)); Console.WriteLine(sortArraryDes.ToString(Formatting.Indented));
标签:obj,no,C#,JArray,jsonArray,json,treatment,key,排序 From: https://www.cnblogs.com/snrj/p/17145366.html