UStructToJsonObject not working as expected since 4.13
Everything works fine at 4.12. However, since 4.13, it returns
After reading the source code, I find the reason is that UE 4.13 added a function
Most important, is there some way to keep it return Object instead of String?
Any help will be appreciate!
I had the same problem and have tracked down the source. In JsonObjectConverter.cpp in the ConvertScalarUPropertyToJsonValue function, in the UStructProperty section, the Struct is first checked for HasExportTextItem(). If it doesn't then it is exported with UStructToJsonObject where the code that checks for FJsonObjectWrapper is located. The problem is that the FJsonObjectWrapper returns true on HasExportTextItem() so the UStructToJsonObject() function is never called for it.
A possible fix would be to disable the HasExportTextItem() check for FJsonObjectWrapper structs.
In my code I fixed this with a patch. I created a CustomExportCallback that checks to see if the property is a FJsonObjectWrapper and calls UStructToJsonObject if it is.
Here is the function that I used with the CustomExportCallback:
answered Feb 27 '17 at 09:06 AM
Joey At Gateway
I am not sure what you are seeing but my FJsonObjectWrapper gives both a FString as "JsonString" and a TSharedPtr as "JsonObject". Here is a screenshot:
Can you please provide more information related to your issue?
answered Sep 19 '16 at 07:39 PM
ImVawx ♦♦ STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here