Newtonsoft.Json

Json 字符串

/*
{
  "values": {
    "target_id": "10383L",
    "target_name": "[大童]烟花防滑闪灯休闲鞋",
    "price": 499,
    "custom_price": 299
  },
  "status": "unchanged",
  "originalIndex": 0,
  "index": 0,
  "id": "frow0"
}
*/

解析字符串:

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

JObject cpinfo = (JObject)JsonConvert.DeserializeObject(Json字符串);
string target_id = cpinfo["values"["target_id"].ToString();//10383L
string custom_price = cpinfo["values"]["custom_price"].ToString();//299
string price = cpinfo["index"].ToString();//0

 

posted @ 2016-07-01 14:33  雨戈  阅读(101)  评论(0)    收藏  举报