I have an API endpoint which is receiving a data string which looks like the following:
"[[0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0],[[],[],[],[[17.637329000012972,17.637329000012972]],[],[],[],[],[]]]"
I would now like to convert this json object into an array which I can query, but I'm not sure where to start.
I have tried converting to a jagged array using
var result = JsonConvert.DeserializeObject<SomeType[][]>(json);
where SomeType has been int, string, double etc etc
The problem seems to lie with each array being anonymous so it's proving difficult to model. To further complicate things some of the arrays found in the base array are also jagged arrays. As it happens I'm only really interested in the first array so if anyone can offer an easy way of extracting this I would be very grateful. Thanks in advance
> results = JsonConvert.DeserializeObject
– Trevor Mar 05 '21 at 19:52>>(json);`. Also I'm not sure what exactly you would query of of this, what would your query be based on?
> throws an error. This data is passed to my API from an xApi elearning module. The first array within the array refers to the sections of the course, if it's 1 then it's complete if it's 0 it is not. This array can then be used to calculate the users progress in the course
– Ryan Mar 05 '21 at 20:00>` which gives me 2 objects in that list, with the first list having 16 objects and the last gives me 9 with no issues and matches your data; there's no errors. Could you be specific about `throws an error`?
– Trevor Mar 05 '21 at 20:05>`.
– dbc Mar 05 '21 at 21:15