Complex JSON String to Unreal Engine UStruct

I have a JSON string coming from an API that I want to feed into a USTRUCT to access the data and perform operations based on the data later.

In Unity I am able to parse the JSON String easily into a container like this :


 
 public Dictionary<string, Dictionary<string, double]>> SettingsPerOrganization { get; set; } 

Problem is Unreal Engine does not supports nested containers, so I am unable to parse all data in a similar struct like above with the below code :


 
 FJsonObjectConverter::JsonObjectStringToUStruct(jsonString, &settingsResponseStruct, 0, 0); 

Here is the sample JSON string :



{
  "message": "Success",
  "result": {
    "settings": {
      "settingsPerOrganization": {
        "o_QVdtUks0RkQtTkotVmZMQmF2am4=": {
          "p_QVdtUk5lZkstTkotVmZMQmF2anM=": 
            16.501722462752205,
            80.4483731249899,
            13.125373840332031
          ],
          "p_QVdtUk5ia2NaaHZVZWZ5VkxNNEk=": 
            16.57162381385302,
            80.31361184667094,
            15.995080947875977
          ],
          "p_QVdwekVaeUZaaHZVZWZ5VkxONzI=": 
            16.527169180932326,
            80.49053585008252,
            14.214865684509277
          ]
        },
        "o_QVY2cTMyUHZka1hyd185Q3Z3QTg=": {
          "p_QVdkekViU09NaEJlbGJkYTVMbnQ=": 
            28.369053770071247,
            77.3754962913513,
            8.374844551086426
          ],
          "p_QVd1SlEtY0ZrZkpLSk0tRWF3ODA=": 
            1.3021882099881477,
            103.83580351314065,
            12.87491512298584
          ],
          "p_QVd1VHFUb0QwOEVXaWw0d2lDRTY=": 
            6.365862004186035,
            -3.777785427283305,
            7.044849872589111
          ],
          "p_QVdxbG9oLVMwOEVXaWw0d2lCT0M=": 
            41.01870944998139,
            -73.81841922583119,
            7.425075054168701
          ],
          "p_QVd3OXl1dFFrZkpLSk0tRWF5YUE=": 
            24.421013253602393,
            54.610854396100144,
            14.064905166625977
          ],
          "p_QVc0YjlKclk1YTlRamJHSnVjblc=": 
            16.5239037176696,
            80.4928364391836,
            14
          ],
          "p_QVc0bkZ5VnZVVFYwdThUdEdRV3U=": 
            57.14792076038094,
            -2.0970229868889394,
            16.137773513793945
          ],
          "p_QVdwM1gwckdaaHZVZWZ5VkxOOVE=": 
            24.6771252713095,
            46.7003073394814,
            16
          ]
        },
        "o_QVdkLV9LMjJFcHM1Mko3Qlh1UHE=": {
          "p_QVdkLV9MRnBNaEJlbGJkYTVMcDA=": 
            52.0379079840953,
            -2.06805253953321,
            11
          ],
          "p_QVd1YWtoUjB3cDI5V1J5Q3VPajE=": 
            51.80050094845883,
            -1.0958483367530247,
            11
          ]
        }
      }
    }
  }
}


I have tried parsing data with the following struct as seen in other examples on forums, since the object keys are not always same in json string data parsing fails.

Main Container :


 
     UPROPERTY()         TMap<FString, FStringDoubleTMap> settingsPerOrganization; 

Than Supported containers struct :


 
 USTRUCT() struct FDoubleArray {     GENERATED_USTRUCT_BODY();      UPROPERTY()         TArray<double> arrayType; };  USTRUCT() struct FStringDoubleTMap {     GENERATED_USTRUCT_BODY();      UPROPERTY()         TMap<FString, FDoubleArray> map; }; 

Any help or direction is appreciated.

In TMap data structure of UE4, do not think you will have same key values for more than one object. The purpose of the keys are that you keep unique values to them. So just keep that in mind, if you have a different case you can use different data structure for it.

Your attempt doesn’t work because the entries of the outer map don’t contain a property called “map”. This structure might be impossible to convert with the default thing…