Looks like you are out of luck with those data tables…
I don’t know what is causing this, but here is a workaround that modifies the JsonObject to take out those ugly identifiers, before converting to string.
void FixJsonFieldNames(TSharedPtr<FJsonValue> Elem)
{
if (Elem && Elem->Type == EJson::Object && Elem->AsObject())
{
TArray<FString> Keys;
Elem->AsObject()->Values.GenerateKeyArray(Keys);
for (auto& Key : Keys)
{
auto Value = Elem->AsObject()->GetField<EJson::None>(Key);
FixJsonFieldNames(Value);
if (Key.Len() > 35 && Key[Key.Len() - 33] == TEXT('_'))
{
FString NewKey = Key.LeftChop(33);
int32 i;
if (NewKey.FindLastChar(TEXT('_'), i))
{
NewKey = NewKey.Left(i);
Elem->AsObject()->SetField(NewKey, Value);
Elem->AsObject()->RemoveField(Key);
}
}
}
}
else if (Elem && Elem->Type == EJson::Array)
{
for (auto& Value : Elem->AsArray())
{
FixJsonFieldNames(Value);
}
}
}
Now you need to generate the object first before converting to string :
// Convert to json object
auto JsonObject = MakeShared<FJsonObject>();
FJsonObjectConverter::UStructToJsonObject(USTR, StructPtr, JsonObject, 0, 0, 0);
// Fix field names
FixJsonFieldNames(MakeShared<FJsonValueObject>(JsonObject));
// Convert to json string
FString JsonString;
auto JsonWriter = TJsonWriterFactory<TCHAR, TPrettyJsonPrintPolicy<TCHAR>>::Create(&JsonString, 0);
if (FJsonSerializer::Serialize(JsonObject, JsonWriter))
{
UE_LOG(LogTemp, Warning, TEXT("%s"), *JsonString);
}
JsonWriter->Close();