Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

JsonSerializerOptions.IgnoreNullValues Property

Definition

Namespace:
System.Text.Json
Assembly:
System.Text.Json.dll
Package:
System.Text.Json v11.0.0-preview.5.26302.115
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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); };
[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; }
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}")>]
member this.IgnoreNullValues : bool with get, set
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


Feedback

Was this page helpful?