I have a set of data inside a Json file that represents the GPD evolution for each country every year. I'm trying to extract this data inside a list where every year would be a dictionary inside the list.
This is a part of the Json I'm trying to work with :
{
"Name": "GPD per capita",
"Description": "Real GDP per capita in 2011US$, 2011 benchmark (suitable for cross-country growth comparisons)",
"Suffix": "$",
"Multiplier": "1",
"Data": [
{
"year": "1",
"Belgium": "1050",
"Switzerland": "1050",
"Egypt": "1225",
"Spain": "973",
"France": "1050",
"Greece": "1400",
"Iran (Islamic Republic of)": "1225",
"Iraq": "1225",
"Israel": "1225",
"Italy": "1546",
"Jordan": "1225",
"Portugal": "1050",
"Tunisia": "1225",
"Turkey": "984"
},
{
"year": "730",
"Egypt": "1278",
"Iraq": "1610",
"Japan": "633"
},
...
And this is the class where the Json file should be deserialized :
[Serializable]
public class Collection
{
public string Name;
public string Description;
public string Suffix;
public ulong Multiplier;
public List<IDictionary<string, ulong>> Data;
}
When I do Collection collection = JsonConvert.DeserializeObject<Collection>(jsonFile.ToString());
all the attributes show on the console but not the Data list.
How can I deserialize such structure correctly ?