Im using C# and I need a dictionary with a string Key and a int value. Im using EasyJson to deserialize/serialize. This dictionary is inside a class:
public class LevelManager : MonoBehaviour
{
public float version { get; set; };
public int health { get; set; };
public Dictionary<string,int> powers { get; set; };
}
But I couldn't make a JSON that meets the dictionary format. Every time I use an option I get a cast error I tried this structures (just copying the powers section):
"powers": [
{"Hadoken": 15},
{"Electricity": 20},
{"Rocket": 25},
{"Kick": 20}
]
Another try:
"powers": {
"Hadoken": 15,
"Electricity": 20,
"Rocket": 25,
"Kick": 20
}
And I had many more. What I'm missing? Which is the correct way to format a dictionary in JSON?