I am using an API that returns a bunch of order data as an array of strings.
"orders": [
//[ price, size, order_id ]
[ "295.96","0.05088265","3b0f1225-7f84-490b-a29f-0faef9de823a" ],
...
]
I need to use Json.Net to parse it to an object of the following format:
public class Order
{
public decimal price { get; set; }
public decimal size { get; set; }
public Guid order_id { get; set; }
}
How can I achieve this? I know how to use Json.NET to deserialize an object so I end up with a single property orders of type string array, but is there any way to skip that and have it just directly map to an object instance instead?
var orders = JsonConvert.Deserialize<IEnumerable<Order>>(jsonString)would return a collection of Order "instances" created for you.ObjectToArrayConverter<Order>from C# JSON.NET - Deserialize response that uses an unusual data structure to deserialize that JSON. In fact, this question may be a duplicate of that. Agree?