I need to serialize an object with Newtonsoft JSON, desired output:
[
[[1, 2, "15"],[3, 4, "12"]]
]
My class:
public class Result
{
public int? score1;
public int? score2;
public string id;
}
Id has to be of a string type. After converting to JSON:
string json = JsonConvert.SerializeObject(myObject);
I, quite logically get this:
[
[
{
"score1":null,
"score2":null,
"id":"5824"
},
{
"score1":null,
"score2":null,
"id":"5825"
}
],
[next object]
]
myObject. Assuming it's a collection of collections ofResult, you can useObjectToArrayConverter<Result>from C# JSON.NET - Deserialize response that uses an unusual data structure. In fact I think this is a duplicate, agree?