Thank you, this helped me a lot!
If anyone is interested, based on the example above I used the JsonObjectConverter
to serialize any blueprint struct:
TSharedPtr<FJsonObject> AMyActor::BlueprintStructToJsonAttributes(FProperty* Property, const void* Value)
{
if (FStructProperty* StructProperty = CastField<FStructProperty>(Property))
{
TSharedPtr<FJsonObject> Out = MakeShared<FJsonObject>();
if (FJsonObjectConverter::UStructToJsonAttributes(StructProperty->Struct, Value, Out->Values))
{
return Out;
}
}
return nullptr;
}
The problem with this was that the names of the properties are somewhat cryptic.
In the end I wrote some custom JsonObjectConverter functions to use the AuthoredName
instead.