trying to convert below JSON into a c# object with newtonsoft json converter. The problem comes when trying to resolve attribute "b"/"a" into a class attribute. It's an array of array's that contains 2 strings and an empty array. Empty array will be ignored.
Json:
{
"e": "depthUpdate", // event type
"E": 1499404630606, // event time
"s": "ETHBTC", // symbol
"u": 7913455, // updateId
"b": [ // bid depth delta
[
"0.10376590", // price
"59.15767010", // quantity
[] // can be ignored
],
],
"a": [ // ask depth delta
[
"0.10376586", // price
"159.15767010",
[]
],
[
"0.10383109",
"345.86845230",
[]
],
[
"0.10490700",
"0.00000000", //quantitiy
[]
]
]
}
Current C# class to convert it to:
class DepthInformation
{
[JsonProperty("e")]
public string eventType { get; set; }
[JsonProperty("E")]
public string eventTime { get; set; }
[JsonProperty("s")]
public string symbol { get; set; }
[JsonProperty("u")]
public int updateId { get; set; }
//[JsonProperty("b")]
//public IList<string> bids { get; set; }
Would love for the "a"/"b" attributes to be an array of type Bids class within the DepthInformation class something like:
class DepthInformation
{
[JsonProperty("e")]
public string eventType { get; set; }
[JsonProperty("E")]
public string eventTime { get; set; }
[JsonProperty("s")]
public string symbol { get; set; }
[JsonProperty("u")]
public int updateId { get; set; }
[JsonProperty("b")]
public IList<Bid> bids { get; set; }
}
[JsonArray("b")]
public class Bid
{
// No identifiers here so not sure how to map json to these
decimal price { get; set; }
decimal quantity { get; set; }
}
I'm lost, appreciate any help!