You are getting this error because your JSON is hierarchical while your class is essentially flat. If you use JSONLint.com to validate and reformat the JSON, you can see the structure better:
{
"results": [
{
"series": [
{
"name": "PWR_00000555",
"columns": [
"time",
"last"
],
"values": [
[
"1970-01-01T00:00:00Z",
72
]
]
}
]
}
]
}
This corresponds to the following class structure (which I initially generated using json2csharp.com, then manually edited to add the [JsonProperty]
attributes):
public class RootObject
{
[JsonProperty("results")]
public List<Result> Results { get; set; }
}
public class Result
{
[JsonProperty("series")]
public List<Series> Series { get; set; }
}
public class Series
{
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("columns")]
public List<string> ColumnNames { get; set; }
[JsonProperty("values")]
public List<List<object>> Points { get; set; }
}
You can deserialize your JSON into the above class structure like this:
var root = JsonConvert.DeserializeObject<RootObject>(jsonString);
Fiddle: https://dotnetfiddle.net/50Z64s
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…