You can use a dictionary to parse a JSON object with custom property names:
public class Test
{
public string col1 { get; set; }
public string col2 { get; set; }
}
public class DataValue
{
public Test test { get; set; }
}
public class RootObject
{
public RootObject() { this.data = new Dictionary<string, DataValue>(); }
public Dictionary<string, DataValue> data { get; set; }
}
If you are sure the dictionary keys will always be numeric, you can use integer keys, and use a SortedDictionay
to order the values:
public class RootObject
{
public RootObject() { this.data = new SortedDictionary<long, DataValue>(); }
public SortedDictionary<long, DataValue> data { get; set; }
}
solved How to parse this JSON using Newton Soft for nested object