JsonSerializerOptions.IgnoreNullValues Property
Definition
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); };
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.