Answer the question
In order to leave comments, you need to log in
How to convert JSON to C# class?
There is no way I can convert this json data into a class. No matter how much I try, there are always errors.
I can't change this Json, I get the data via api
JSON
{
"blabla": {
"columns": ["id", "num", "date", "time", "ti", "val"],
"data": [
[30, 45, "2021-05-30", "14:34:34", "FUКЕ", "OLGD"],
[60, 45, "2020-02-30", "02:21:06", "BEВП", "GASF"]
]
}}
public class Blabla
{
public List <string> columns { get; set; }
public List <List <int>> data { get; set; }
}
public class Root
{
public Blabla blabla { get; set; }
}
Answer the question
In order to leave comments, you need to log in
As I understand it, the most important gap in the data array.
If you use System.Text.Json, then it can be typed like this:
[JsonPropertyName("data")]
public JsonElement[][] Data {get; init;}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question