void Start() { ExampleSerializedClass serializedClass = new ExampleSerializedClass(); JsonWriter writer = new JsonWriter(); writer.PrettyPrint = true; JsonMapper.ToJson(serializedClass, writer); string json = writer.ToString(); Debug.Log(json); // If you don't need a JsonWriter, use this. //string json = JsonMapper.ToJson(exampleClass); ExampleSerializedClass deserializedClass = JsonMapper.ToObject <ExampleSerializedClass>(savedJsonString); Debug.Log(deserializedClass.myString); }
void Start() { ExampleSerializedClass serializedClass = new ExampleSerializedClass(); JsonWriter writer = new JsonWriter(); writer.PrettyPrint = true; JsonMapper.ToJson(serializedClass,writer); string json = writer.ToString(); Debug.Log(json); // If you don't need a JsonWriter, use this. //string json = JsonMapper.ToJson(exampleClass); ExampleSerializedClass deserializedClass = JsonMapper.ToObject<ExampleSerializedClass>(savedJsonString); Debug.Log(deserializedClass.myString); }