I have the following problem: I'm trying to parse a nested JSON using the Unity JsonUtility, but if i'm logging one of the nested parameters i get Null as a result.
Here's the Json:
{
"basic": {
"name": "Demo Bow"
},
"effect": {
"damage": {
"stages": 3,
"one": 4,
"two": 10,
"three": 40
}
}
}
And here's my code:
public class Basic
{
public string name;
}
public class Damage
{
public int stages;
public int one;
public int two;
public int three;
}
public class Effect
{
public Damage damage;
}
public class RootObject
{
public Basic basic;
public Effect effect;
}
Edit: No its not a duplicate, cause I already removed the "{ get; set; }" And heres the missing code.
public static RootObject CreateFromJSON(string json){
RootObject weapon = JsonUtility.FromJson <RootObject> (json);
return weapon;
}
Thanks for any help