Edit

Share via


JsonSerializerOptions.IgnoreNullValues Property

Definition

Caution

JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.

Gets or sets a value that indicates whether null values are ignored during serialization and deserialization. The default value is false.

public:
 property bool IgnoreNullValues { bool get(); void set(bool value); };
public bool IgnoreNullValues { get; set; }
[System.Obsolete("JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.", DiagnosticId="SYSLIB0020", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public bool IgnoreNullValues { get; set; }
member this.IgnoreNullValues : bool with get, set
[<System.Obsolete("JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.", DiagnosticId="SYSLIB0020", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.IgnoreNullValues : bool with get, set
Public Property IgnoreNullValues As Boolean

Property Value

true if null values are ignored during serialization and deserialization; otherwise, false.

Attributes

Exceptions

This property was set after serialization or deserialization has occurred.

-or-

DefaultIgnoreCondition has been set to a non-default value. These properties cannot be used together.

Remarks

For more information, see How to ignore properties.

Applies to