I tried to deserialize JSON string to object, but got an exception, really confused.
"{
\"lastUpdateId\":787618462,
\"bids\":[[\"10451.90000000\",\"0.18884000\"],[\"10451.70000000\",\"0.01770200\"]],
\"asks\":[[\"10457.88000000\",\"0.17060500\"],[\"10458.13000000\",\"0.79300000\"]]
}"
and this is the needed object:
public class OrderBook
{
[JsonProperty("lastUpdateId")]
public int lastUpdateId { get; set; }
[JsonProperty("asks")]
public List<OrderBookOrder> Asks { get; set; }
[JsonProperty("bids")]
public List<OrderBookOrder> Bids { get; set; }
public OrderBook(List<OrderBookOrder> asks, List<OrderBookOrder> bids)
{
Asks = asks;
Bids = bids;
}
public OrderBook()
{
}
}
public class OrderBookOrder
{
public decimal Price { get; set; }
public decimal Volume { get; set; }
public OrderBookOrder(decimal price, decimal volume)
{
Price = price;
Volume = volume;
}
}
so then I use NewtonSoft Json to convert the string to object
public static implicit operator OrderBook(ApiResponse response)
{
return Utilities.ConverFromJason<OrderBook>(response);
}
I think that problem is to parce two arrays (bids and asks) but can`t solve the problem. Thanks a lot for help!