赞
踩
从网上找了很多资料,都不靠谱,所以写了个,虽然方法笨了点,但总算是实现了
添加引用,NuGet搜 Newtonsoft.Json
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
public static string[][] getObjectByJson(string jsonString)
{
string[][] ret = null;
JArray json1 = (JArray)JsonConvert.DeserializeObject(jsonString);
int count = json1.Count;
if (ret == null)
{
ret = new string[count][];
}
for (int i = 0; i < count; i++)
{
Console.WriteLine(json1[i].ToString());
JArray json2 = (JArray)JsonConvert.DeserializeObject(json1[i].ToString());
int count2 = json2.Count;
ret[i] = new string[count2];
for (int j = 0; j < count2; j++)
{
ret[i][j] = json2[j].ToString();
}
}
return ret;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。