<PackageReference Include="System.Text.Json" Version="8.0.3" />

JsonPolymorphicAttribute

public sealed class JsonPolymorphicAttribute : JsonAttribute
When placed on a type, indicates that the type should be serialized polymorphically.
using System.Runtime.CompilerServices; namespace System.Text.Json.Serialization { [System.Runtime.CompilerServices.NullableContext(2)] [System.Runtime.CompilerServices.Nullable(0)] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false, Inherited = false)] public sealed class JsonPolymorphicAttribute : JsonAttribute { public string TypeDiscriminatorPropertyName { get; set; } public JsonUnknownDerivedTypeHandling UnknownDerivedTypeHandling { get; set; } public bool IgnoreUnrecognizedTypeDiscriminators { get; set; } } }