Download

Multiple arrays of structs into JSON in a simple way?

Is it possible to convert arrays of structs to JSON in a short way, as in one function works for all structs so it would just do it in json like for example:

{
“inventory”: {“item”: amount},
“achievements”: {“achievement”:progress}
}

Where inventory and achievements are different structs, and the function would convert those to the desired json with just one array input.

Sounds to me like it wouldn’t be possible, but wont hurt to ask

If you add your arrays to a master UStruct then you can convert the whole pack of arrays to a Json string and convert back with a single function:

I got UStructToJsonObjectString working, but JsonObjectStringToUStruct just spews out all kinds of errors…

Edit, I figured it out, had JsonUtilities added in build.cs and had to add Json as well.