using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Converters;
using System.Collections.Generic;
public static void Main()
string json = "{\"data\": { \"1\": { \"test\": { \"col1\": \"123\", \"col2\": \"name\" } }, \"2\": { \"test\": { \"col1\": \"345\", \"col2\": \"name2\" } }, \"3\": { \"test\": { \"col1\": \"456\", \"col2\": \"name3\" } }}}";
var settings = new JsonSerializerSettings
Converters = new JsonConverter[] { new ObjectAsArrayConverter() }
JsonConvert.DeserializeObject<Root>(json, settings).Dump();
public class ObjectAsArrayConverter : JsonConverter
public override bool CanConvert(Type type)
typeof(List<>) == type.GetGenericTypeDefinition() &&
typeof(Data) == type.GetGenericArguments()[0];
public override object ReadJson(
JsonSerializer serializer)
JObject obj = JObject.ReadFrom(reader).ToObject<JObject>();
.Select(p => new { Index = int.Parse(p.Name), Value = obj[p.Name].ToObject<Data>() })
public override void WriteJson(
JsonSerializer serializer)
throw new NotImplementedException();
public List<Data> Data {get; set;}
public Test Test { get; set; }
public string Col1{get; set;}
public string Col2{get; set;}