C++ Nested JSON in Unreal Engine 4

后端 未结 2 625
忘了有多久
忘了有多久 2021-02-09 12:08

I have a JSON object that I am getting from my server that looks something like this:

{
    "state":"1",
    "player1": {
        &q         


        
2条回答
  •  猫巷女王i
    2021-02-09 12:48

        for (auto currJsonValue = JsonObject->Values.CreateConstIterator(); currJsonValue; ++currJsonValue)
        {
            // Get the key name
            const FString Name = (*currJsonValue).Key;
    
            // Get the value as a FJsonValue object
            TSharedPtr< FJsonValue > Value = (*currJsonValue).Value;
    
            TSharedPtr JsonObjectIn = Value->AsObject();
        }
    

    The Json Object nested can be accessed by GetObjectField or the code I posted.

提交回复
热议问题