jsonUtility prettyprint file size

I’ve been testing jsonUtility for serialization/deserialization.

I was originally using xml, with a test xml file that’s 38.1kb.
I converted that to a “pretty” json file that’s 33.4kb.

I deserialized the json file and serialized using prettyprint. The resulting file size is 3 times the size at 89.8kb because it’s using spaces instead of tabs. By replacing each group of 4 spaces with tabs, the file became 39.9kb.

I know it’s not recommended for production (serializing without prettyprint is 18.6kb, so far better) but it can still be lots more efficient if prettyprint uses tabs instead of spaces…

use this

#if UNITY_EDITOR
        string data = JsonUtility.ToJson(jsonData , true);
        #else
        string data = JsonUtility.ToJson(jsonData);
        #endif