Avoiding interfaces in DTOs

Basically you’ll want to design it so DTO’s don’t use polymorphism. You can look take a similar approach to how Amazon DynamoDB handles multiple different types in its AttributeValue where it contains a DTO with explicit properties for different value types.

You can make this more dynamic by just storing the value in a string in which case you’ll want to capture the type it is, e.g:

class CustomProperty
{
    string Type
    string Value
}

For storing objects you could serialize it as JSON in the Value or have a more structured type for storing Object properties, likewise with arrays, e.g:

class CustomProperty
{
    Dictionary<string,CustomProperty> Object
    List<CustomProperty> Array
}