<PackageReference Include="System.Text.Json" Version="7.0.0-preview.6.22324.4" />

JsonPolymorphicAttribute

public sealed class JsonPolymorphicAttribute : JsonAttribute
When placed on a type, indicates that the type should be serialized polymorphically.
public bool IgnoreUnrecognizedTypeDiscriminators { get; set; }

Gets or sets a value that indicates whether the deserializer should ignore any unrecognized type discriminator IDs and revert to the contract of the base type.

public string TypeDiscriminatorPropertyName { get; set; }

Gets or sets the behavior when serializing an undeclared derived runtime type.