我有这种JSON,如何用newtonsoft
转换为C#对象。
[["Newyork", "Goods & Services", "Description", "02/23/2016", "03/15/2016", "some info"]]
答案 0 :(得分:5)
使用以下代码:
string jsonString = @"[[""Newyork"", ""Goods & Services"", ""Description"", ""02/23/2016"", ""03/15/2016"", ""some info""]]";
List<string[]> data = JsonConvert.DeserializeObject<List<string[]>>(jsonString);
答案 1 :(得分:1)
您可以使用JsonConvert.DeserializeObject
进行此转换。如下所示:
string inputString= @"[[""Newyork"", ""Goods & Services"", ""Description"", ""02/23/2016"", ""03/15/2016"", ""some info""]]";
List<string[]> jsonData = JsonConvert.DeserializeObject<List<string[]>>(inputString);