My JSON has this information:
[
{
"era_1":{"technology_cost":"10000"},
"era_2":{"technology_cost":"15000"},
"era_3":{"technology_cost":"20000"},
"era_4":{"technology_cost":"25000"},
"era_5":{"technology_cost":"30000"}
}
]
I want to do:
EraData = JsonConvert.DeserializeObject<List<ClassEra>>(JSON);
Being ClassEra
public class ClassEra
{
public string name { get; set; }
public string technology_cost { get; set; }
}
And obviously it doesn't work.
I don't understand the type of data that is coming out of the deserializer.
By the way I'm using Newtonsoft.
>>(JSON);`. See as shown in [Deserializing JSON when key values are unknown](https://stackoverflow.com/a/24901245/3744182).
– dbc Oct 23 '22 at 17:51>>(JSON)`. The `era_X` names will be deserialized as the dictionary keys, the `{"technology_cost":"XX"}` objects as the dictionary values. Also you can remove `name` from `ClassEra`.
– dbc Oct 23 '22 at 17:57