c#将json串转换成数组

引用

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


程序

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"];
            int i = array.Count;
             string aa="";
             foreach (var jObject in array)
            {
                //赋值属性
                aa = jObject["id"].ToString();//获取字符串中id值
            }


            }

你可能感兴趣的:(c#)