FInstancedStruct property not exporting to JSON in UDataTable::GetTableAsJSON() on UE 5.5+

Hello,

I’m encountering an issue where properties of type ‘FInstancedStruct’ are not exported to JSON when using UDataTable::GetTableAsJSON() with the ‘EDataTableExportFlags::UseJsonObjectsForStructs’ flag.

It seems that within DataTableJSON.cpp, the WriteStruct() function fails to serialize ‘FInstancedStruct’ properly because the TFieldIterator<const FProperty> used in the function does not find any properties inside the ‘FInstancedStruct’.

I noticed that as of Unreal Engine 5.5, ‘FInstancedStruct’ (from the StructUtils plugin) has been moved to the CoreUObject module, which led me to assume it should now be supported for DataTable export. However, the export still doesn’t seem to handle it correctly.

`template
bool TDataTableExporterJSON::WriteStruct(const UScriptStruct* InStruct, const void* InStructData, const FString* FieldToSkip)
{
for (TFieldIterator It(InStruct); It; ++It)
{
const FProperty* BaseProp = *It;
check(BaseProp);

const FString Identifier = DataTableUtils::GetPropertyExportName(BaseProp, DTExportFlags);
if (FieldToSkip && *FieldToSkip == Identifier)
{
// Skip this field
continue;
}

if (BaseProp->ArrayDim == 1)
{
const void* Data = BaseProp->ContainerPtrToValuePtr(InStructData, 0);
WriteStructEntry(InStructData, BaseProp, Data);
}
else
{
JsonWriter->WriteArrayStart(Identifier);

for (int32 ArrayEntryIndex = 0; ArrayEntryIndex < BaseProp->ArrayDim; ++ArrayEntryIndex)
{
const void* Data = BaseProp->ContainerPtrToValuePtr(InStructData, ArrayEntryIndex);
WriteContainerEntry(BaseProp, Data);
}

JsonWriter->WriteArrayEnd();
}
}

return true;
}`

Is there any official support or workaround for exporting FInstancedStruct properties to JSON via UDataTable::GetTableAsJSON()?

Thank you for your help.

Steps to Reproduce:

1) In C++ or Blueprint, declare a UStruct that includes an FInstancedStruct as a member property.

2) Create a UDataTable that uses this struct as its row type.

3) Populate the DataTable with one or more rows, then right-click the asset in the Content Browser and choose “Export as JSON”.

Result) The property of type FInstancedStruct only shows the property name in the JSON output, but its value is empty.​

Hello there,

This appears to be related in terms of the reason for why serialisation fails to the following case: [Content removed]

Does that appear to be the case?

Best regards,

Chris

This is a different case from the one you provided.

First of all, when exporting a DataTable that contains an FInstancedStruct property, there is no issue when exporting to CSV.

The problem only occurs when exporting to JSON.

Additionally, it’s not a matter of the property being reset to its default value — none of the internal properties of the FInstancedStruct are exported at all.

[Image Removed]

I see. It had seemed similar, but this appears specifically due to the attempted iteration of the InstancedStruct rather than it’s inner. It also isn’t writing the struct type, though.

It appears the CSV method is using the same text export format as DeveloperSettings, which appears to be why this is working in 5.6.

I’m not of what the best workaround would be here, other than potentially using CSV. The risk with modifying engine code this deep is unintended consequences that affect other systems.

In the meantime, I’ll file a bug report for this to get this on the radar, and I’ll reply here with a tracking link when one is available.

Best regards,

Chris

The tracking link should be live at Unreal Engine Issues and Bug Tracker (UE\-309260)

Best regards,

Chris

Thanks for your support

You are very welcome.

If you have any further questions, please feel free to ask. Otherwise, would you mind if I close out this case for now?

Best regards,

Chris

Thanks, Chris.

I’ll monitor the tracking link you shared. I don’t have any further questions — please feel free to close the case.