JsonSerializerOptions.IncludeFields Property

Definition

Gets or sets a value that indicates whether fields are handled during serialization and deserialization. The default value is false.

C#
public bool IncludeFields { get; set; }

Property Value

true if public fields are included during serialization; otherwise, false.

Exceptions

This property is set after serialization or deserialization has occurred.

Remarks

This flag only enables serialization for public fields, as is the case for properties. Private members need to be opted into individually using the JsonIncludeAttribute attribute.

Applies to

Produkt Versioner
.NET 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)