As you can see, I have my own structure, and I want to create my own datatable in C++ which will use FJsonData as it’s row structure. How can I set my own structure as DataTable’s row structure?
Anyone has Idea? I’ve searching google for several days, but there’s no answer.
What I’m trying to do is parsing Json data and create a datatable asset with it from C++ so that I can use it in Blueprint level.
Never mind! I found the way to do that. Will upload how I did that to my website someday.
What I did is just implementing my own json parser so that it can add data to the datatable which is already allocated to the actor
I want to create a datatable from the data I parsed from Json. Which means, I want import Json in C++ level, and creates an asset.If there’s any way I can creates Datatable with the data I parsed from Json, that will do too. Actually, Unreal provides functionality to import Json with certain structure to creates datatable. But when I tried that, it didn’t work properly. Most of the values are wrongly parsed, If you know how to do that, please tell me. Thanks!
Well, basically what I did is creating datatable in UE4 editor level, and allocate it to my actor. Then actor creates the datatable contents based on the structure I defined. What I referenced is Unreal’s Json parser itself. I’m in the middle of my semester, so detail explanation will be uploaded somewhere around December
UE4.12 has some troubles with importing UDataTable from JSON. Try switching to 4.13 - all of my problems have gone after this switch.
Regarding Json import, I did the following.
Locate row structure:
UScriptStruct* ImportRowStruct = LoadObject<UScriptStruct>(nullptr, TEXT("/Game/Blueprints/RowStruct.RowStruct")); // I used script structure to allow data table to be used from blueprints without any C++ game code
The code has some capabilities for updating existing table using reimport, which are not listed here. Using DataTableFactory simplifies workflow a lot. For instance, if you’ll update contents of the Json file, it will be automatically reimported into the engine (with a prompt to user).