Need help about FJsonObjectConverter::UStructToJsonObject ?

Hello Everyone,

This is my first post here :slight_smile:

I encounter a problem in my code today, I create a map editor for my Puzzle Reflexion Game which saves my levels into a json file.
However, I really don’t unterstand how to use this function… :…t/2/index.html

for (auto it = JsonArray.CreateIterator(); it; ++it)
            int32 index = it.GetIndex();
            TSharedPtr<FJsonValue> value = JsonArray[index];
            TSharedPtr<FJsonObject> json = value->AsObject();
            if (Level.Name == json->GetStringField("Name")) {
                exist = true;
                TSharedPtr<FJsonObject> JsonObject = MakeShareable(new FJsonObject());
                if (!FJsonObjectConverter::UStructToJsonObject(??, &Level, JsonObject.ToSharedRef(), 0, 0)) {
                    ret = false;
                json = JsonObject;

                FString OutputString;
                TSharedRef< TJsonWriter<> > Writer = TJsonWriterFactory<>::Create(&OutputString);
                FJsonSerializer::Serialize(JsonArray, Writer);
                ret = FFileHelper::SaveStringToFile(OutputString, *path2);

To explain this loop, I try to replace a stored save in my json.
Level is an instanciated custom struct, called FLevelStruct, which contains all my levels informations.

I don’t know how I can get an UStruct* from my FLevelStruct…

I hope I can find help here. :slight_smile:

In advance, thanks you !


I think you could use FLevelStruct::StaticClass().