c# 读取json字符串节点内容

发布时间 2023-07-13 09:21:02作者: gds111789

c# 读取json字符串节点内容

string jsonstr = "{\"voiceprompt_callback\": {\"result\": \"1\",\"accept_time\": \"0\"}}";


var ty = JsonConvert.DeserializeObject(jsonstr);

Newtonsoft.Json.Linq.JObject js = ty as Newtonsoft.Json.Linq.JObject;

Newtonsoft.Json.Linq.JToken model = js["voiceprompt_callback"];

string c1 = model["result"].ToString();
string c2 = model["accept_time"].ToString();