JToken取出JSON中任何一个节点的值
https://www.lmlphp.com/user/120373/article/item/1777247/
//string jSonStr = "{\"co_id\":10413817,\"shop_id\":11842588}"; //string jSonStr = "{\"Result22\":\"0\",\"Message\":\"数据保存失败\",\"ErrList\":[],\"SucessList\":[]}"; string jSonStr = "{\"adOrderId\":\"AD202207130030100040000184\",\"consigneeInfo\":{\"receiverAddress\":\"123456789\",\"receiverMobile\":\"\"},\"goodsList\":[{\"color\":\"充值\",\"discountDetails\":[{\"Name\":\"BOB\",\"Age\":\"88\"}],\"skuId\":\"1324515449706758145\",\"styleNo\":\"Q9001111060\"}],\"num\":1,\"orderId\":\"202207130030100040000184\",\"otherInfo\":{\"warehouseCode\":\"310104000000\"},\"paymentTime\":1657702070000,\"updateTime\":1657702130000}"; JObject obj = JObject.Parse(jSonStr); JToken result = obj as JToken; string ReName = "warehouseCode"; string para = "$.." + ReName; var str = result.SelectToken(para);
通过SelectToken获取json集合中的指定的值:JToken result = o.SelectToken("$.Databases[?(@.Id == 2)]");
https://www.5axxw.com/questions/content/bdtg8p
人各有命,上天注定,有人天生为王,有人落草为寇。脚下的路,如果不是你自己的选择,那么旅程的终点在哪,也没人知道。你会走到哪,会遇到谁,都不一定。