Hello,
I finally found “the problem” by removing codes function with dichotomy
methodology.
Below the code, I hope it’ll help:
FString Json = gameSession.GetMatchmakerData();
TSharedPtr<FJsonObject> JsonObject;
TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create(Json);
FPlayerData PlayerData;
if (FJsonSerializer::Deserialize(Reader, JsonObject) && JsonObject->HasField("teams")) {
const TArray<TSharedPtr<FJsonValue>> Arr_Teams = JsonObject->GetArrayField("teams");
for (int i = 0; i < Arr_Teams.Num(); i++) {
const TSharedPtr<FJsonObject> TeamJsonObject = Arr_Teams[i]->AsObject();
const TArray<TSharedPtr<FJsonValue>> Arr_Players = TeamJsonObject->GetArrayField("players");
for (int j = 0; j < Arr_Players.Num(); j++) {
this->Arr_PlayerDatas.Add(FPlayerData(*Arr_Players[j]->AsObject().Get())); //this line was the problem
}
}
}
I replaced the problematic line by:
PlayerData = FPlayerData();
PlayerData.InitJson(*Arr_Players[j]->AsObject().Get());
this->Arr_PlayerDatas.Add(PlayerData);
For info FPlayerData is USTRUCT. Refactoring the custom construct to a function (InitJson) did the trick.
Have a good week-end.