I was practising JSON Deserialization using JSONUtility in Unity engine.I solved some examples using POCO class when the properties were string with help of stackoverflow(Link).I have solved the following JSON.Link using the exact names in the POCO class.But when the JSON properties contains integers like the following .
{
"1": {
"Armor": 1,
"Strenght": 1
},
"0": {
"Armor": 1,
"Mana": 2,
"Strenght": 1,
"Health": 1,
"Power": 1
}
}
Solving in a similar way did not work out.From the feedback I got,I have to use dictionary.
IEnumerator GetExampleValues()
{
string URLss = "http://www.json-generator.com/api/json/get/bOQGnptixu?indent=2";
WWW readjson = new WWW(URLss);
yield return readjson;
Debug.Log("ReadJSON"+readjson.text);
}
My POCO class below
using System.Collections.Generic;
[System.Serializable]
public class Exampleget
{
public int Power;
public int Mana;
public int Strenght;
public int Armor;
public int Health;
}
public class GetNumbers
{
public List<Exampleget> onevalues;
}