When I use JsonUtility.ToJson() from Unity (2019.3.0) it returns the JSON string in one line like:
{"ID":0,"Name":"David","HairColor":{"r":0,"g":0,"b":0}}
My question is: How can I make it to get:
{
"ID":0,
"Name":"David",
"HairColor":{
"r":0,
"g":0,
"b":0
}
}
And can I use too JsonUtility.FromJson() to get the information as simple as always?
You have to read the documentation:
JsonUtility.ToJsonpublic static string ToJson(object obj, bool prettyPrint);
prettyPrintIf true, format the output for readability. If false, format the output for minimum size. Default is false.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With