How to use JSon with Unreal

In order to get your JSon data work inside Unreal there are some rules that need to be observed, after some trials and error here's some guideline that would help you to get your JSon data inside your Unreal project or vice-verca :


Properties inside your Unreal USTRUCT need to be tagged with UPROPERTY

Do not use native Unreal struct to store JSon information. As an example suppose that we want to store a position, as a general rule we would have declared an FVector, but since with JSon those information are contained within an array, we need to use a TArray[3] instead.


Code examples

Fill unreal struct parameters


Struct declaration


Check JSon file


Simple JSon data


In case the JSon file doesn't contain nested objects, the following code would automatically fill the CameraParameters by the received data from JSon


Nested Json Data


In case the JSon file contain nested objects, we need then to dig deeper in order to get the needed data, the following code will search for the CameraParameters and will fill our Unreal struct with it


Fill a JSon file with Unreal information and save it