1

The response JSON has the following format:

[ [174854391,1516548168819,0.1011,11841], [174854384,1516548165151,1.05935542,11842], [174854383,1516548165149,0.18174458,11841], [174854363,1516548161814,0.01,11841] ]

which can also be represented as follows [ [ ID, MTS, AMOUNT, PRICE ], [ ID, MTS, AMOUNT, PRICE ], [ ID, MTS, AMOUNT, PRICE ]... ]

When I deserialize the JSON string I need to map each block into a new object, for example

public class myObject
{
   public long id { get; set; }
   public double mts { get; set; }
   public double amount { get; set; }
   public double price { get; set; }
}

so the final result should be

List<myObject>

I don't have any problem to map a JSON into objects when the string has the key:value format, but since I don't have keys here I wonder what is the best way to accomplish the task.

My solution is verbose and it uses regular expressions, which sounds crazy to me because I'm sure this is a very common issue that could be probably solved easily using the right Json.NET method.

Many thanks, Chris

Fabjan
  • 13,506
  • 4
  • 25
  • 52
Ting
  • 111
  • 5

0 Answers0