using System.Collections.Generic;
using Newtonsoft.Json.Linq;
private static string Json = @"
'remainingPaid': 9999999999,
public static void Main()
var result = JsonConvert.DeserializeObject<Root>(Json);
result.Result[result.Result.Keys.First()].Dump();
public Dictionary<int, InnerMost[]> Result { get; set; }
public Allowance Allowance { get; set; }
public int Cost { get; set; }
public int Remaining { get; set; }
public long RemainingPaid { get; set; }
public string Account { get; set; }
[JsonConverter(typeof(ArrayToObjectConverter<InnerMost>))]
public long CloseTime { get; set; }
public decimal Open { get; set; }
public decimal High { get; set; }
public decimal Low { get; set; }
public decimal Close { get; set; }
public decimal Volume { get; set; }
public decimal QuoteVolume { get; set; }
class JsonArrayIndexAttribute : Attribute
public int Index { get; private set; }
public JsonArrayIndexAttribute(int index)
class ArrayToObjectConverter<T> : JsonConverter where T : class, new()
public override bool CanConvert(Type objectType)
return objectType == typeof(T);
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
JArray array = JArray.Load(reader);
var propsByIndex = typeof(T).GetProperties()
.Where(p => p.CanRead && p.CanWrite && p.GetCustomAttribute<JsonArrayIndexAttribute>() != null)
.ToDictionary(p => p.GetCustomAttribute<JsonArrayIndexAttribute>().Index);
JObject obj = new JObject(array
return propsByIndex.TryGetValue(i, out prop) ? new JProperty(prop.Name, jt) : null;
serializer.Populate(obj.CreateReader(), target);
public override bool CanWrite
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
throw new NotImplementedException();