How to stop case correction when converting from Struct to JSON in Packaged Build?
Have a custom struct I'm trying to convert to JSON. It successfully converts to JSON with the correct capitalization (matching the variable names of the struct) in the editor, but the capitalization on the variable names gets corrected in a packaged build, which messes up the API I'm using.
For example, the struct variable name is "userID", which is what the API expects, but when I use the UE4 methods to serialize the struct into JSON the variable name becomes "UserId" which makes the JSON object not work with the API.
I found in the JsonObjectConverter::UStructToJsonAttributes that there's a line that calls StandarizeCase(Property->GetName()), so I made a custom version of this function and removed this line but it didn't solve the problem. In fact, I traced the problem through debugging to when it begins iterating through the uproperties of the struct. It seems to think the variable names are capitalized a different way from the start of iteration when passed the ustruct type.
Furthermore, it doesn't capitalize all variable names. Here are some of the variable names and what they print out as in a packaged build (all names are correct in-editor):
Also, names inside the tmap called "eventParams" don't seem to change. I send the events to the API and can confirm that there's no issue with misprinting to the console as the API confirms the names have changed as listed above.
I'm highly suspicious of the FNames assigned to these variables. I believe the FNames are saved somewhere as "UserId" for example and even though I changed it to "userID" in code. According to this question Fnames became case sensitive in 4.5 which in theory should be good but I'm not seeing the change reflected.
I've tried completely removing the struct and all functions related to it, deleting the Intermediate and Saved folders, and rebuilding and packaging without the struct, then adding them back in but the fnames seem to still be retained!
I'm currently building a struct to JSON converter from scratch to avoid this issue, but figured I'd ask to see if anybody else has had this issue or knows if I'm doing something wrong or how to get around it. Again, the whole thing works as-is in editor and standalone, just packaged builds are the problem. Any help is greatly appreciated.
Here is my struct:
Here is the the templated function I would like to call:
Follow this question
Once you sign in you will be able to subscribe for any updates here