How to parse this json string? I tried to put in in Dictionary
var dictionary = text.FromJson<Dictionary<string, string>>();
but the array is not parsed.
{"v":[[9,-1],[9,-44,1]]}
このクラスを試す
public class Root
{
public List<List<int>> v;
}
var result = text.FromJson<Root>();
編集
json文字列が変わったので、Json.Netを使ったサンプルを用意しました
string json = @"{ v: [ [ 9, 16929, 1, 856, 128, '123', 'hello', {'type': 'photo', 'attach1': '123_456'} ] ] } ";
var obj = (JObject)JsonConvert.DeserializeObject(json);
foreach (var arr in obj["v"])
{
foreach(var item in arr)
{
if (item is JValue)
{
Console.WriteLine(item);
}
else
{
Console.WriteLine(">>> " + item["type"]);
}
}
}
間違った構造を使用しています。値は多次元配列であり、文字列ではありません。タイプを試す
Dictionary<String, List<List<int>>>
var dictionary = text.FromJson< Dictionary<String, List<List<int>>>>();