I'm trying to deserialize a JSON file but I'm currently stuck because of the Array "statistics".
My JSON file looks like this:
[
{
"name": "itemName",
"level": 8,
"imgUrl": "https://imgItemName.png",
"description": "itemDescription.",
"statistics": [
{
"Vitality": {
"min": 10,
"max": 13
}
}
]
}
]
My classes look like this:
public class Item
{
public string name;
public int level;
public string type;
public string imgUrl;
public string description;
public List<Statistics>statistics;
//public List<JArray> statistics;
//public Statistics[] statistics;
}
public class Statistics
{
public string Vitality;
public List<MinMax> minmax;
//public MinMax[] minMax;
}
public class MinMax
{
public string min;
public string max;
}
And this is how I'm trying to deseralize the file:
string json = System.IO.File.ReadAllText("items.json");
var listItems = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Item>>(json);
I have already tried many combinations but cannot recover the Statistics key in any case. Any help will be really appreciated :)