Micro tutorial - Use a string to store complex data instead of a struct or map

Isn´t much better to Convert a struct of data into a JSON string instead? Save to memory then convert back to a struct?
Exemple below:

// The below variable is declared in h file so can stay in memory and acessed anytime:
JSONLoad

// The struct can also be declared or coming from a Function parameter:
FMyStruct LocalStruct;
FJsonObjectConverter::UStructToJsonObjectString(LocalStruct, JSONLoad, 0, 0);

Then convert back
FMyStruct LocalStruct;
FJsonObjectConverter::JsonObjectStringToUStruct(JSONLoad, &LocalStruct, 0, 0);

Can also save that string to a file and use as a SaveGame file or anything else

1 Like