C#中将string类型的json字符串转化成数组添加引⽤
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using System.Collections.Generic;
string jsonText = {"Total":"0",
"Rows":
[
{
"id":"31",
"project":"6",
"project_name":"⼀卡通",
"name":"接⼝测试!",
"assignedTo":"zhangsan",
"realname":"张三",
"estStarted":"2016/11/23",
"realStarted":"2000/01/01",
"status":"wait"
},
{
"id":"32",
"project":"6",
"project_name":"⼀卡通",
"name":"测试服务器调通!",
"assignedTo":"lisi",
"realname":"李四",
"estStarted":"2016/11/23",
"realStarted":"2016/11/23",
"status":"wait"
}
]}
JObject json1 = (JObject)JsonConvert.DeserializeObject(jsonText);
JArray array = (JArray)json1["Rows"];
string aa="";
foreach (var jObject in array)
数组转换成字符串{
//赋值属性
aa = jObject["id"].ToString();//获取字符串中id值
}
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论