I have a problem to read json to object:
{
"root":[
{
"arr1":[
{
"name":"n1",
"age": "a2"
},
{
"name":"n2",
"age":"a2"
}
]},
{
"arr2":[
{
"name":"n11",
"age" : "age22"
},
{
"name":"n12",
"age" :"a21"
}
]}
]
}
It seemed to me it could work on this way:
public class Root
{
public List<Arr> myArr{ get; set; }
}
public class Arr
{
public Dictionary<string, List<Info>> info{ set; get; }
}
public class Info
{
public string name{get;set;}
public string age {get;set;}
}
Root root = JsonConvert.DeserializeObject<Root>(json);
This will return Root object which will have 3 objects, but each of the objects (Arr) would be null. Obviously I am doing something wrong, but I have no idea what. Ideally, it would be even better to get just Dictionary> as final result
NOTE: Example above is just simple example, there will be more "arrX" objects, I need it to be loaded dynamically.