use json in unity code example
Example 1: how to use json in unity
string json = JsonUtility.ToJson(myObject);
// json now contains: '{"level":1,"timeElapsed":47.5,"playerName":"Dr Charles Francis"}'
Example 2: how to use json in unity
myObject = JsonUtility.FromJson<MyClass>(json);
Example 3: how to use json in unity
MyClass myObject = new MyClass();
myObject.level = 1;
myObject.timeElapsed = 47.5f;
myObject.playerName = "Dr Charles Francis";