JsonTypeInfo.PolymorphismOptions Property

Definition

Gets or sets a configuration object specifying polymorphism metadata.

public System.Text.Json.Serialization.Metadata.JsonPolymorphismOptions? PolymorphismOptions { get; set; }

Property Value

Exceptions

value has been associated with a different JsonTypeInfo instance.

The JsonTypeInfo instance has been locked for further modification.

-or-

Polymorphic serialization is not supported for the current metadata Kind.

Remarks

For contracts originating from DefaultJsonTypeInfoResolver or JsonSerializerContext, the configuration of this setting will be mapped from any JsonDerivedTypeAttribute or JsonPolymorphicAttribute annotations.

Applies to

Product Versions
.NET 7, 8 (package-provided), 8, 9 (package-provided), 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)