JsonIgnoreNullsModifier Class
Provides a System.Text.Json.Serialization.Metadata.JsonTypeInfo modifier that enforces null-omission for all nullable properties of types decorated with JsonIgnoreNullsAttribute.
public static class JsonIgnoreNullsModifierInheritance System.Object → JsonIgnoreNullsModifier
Remarks
Register Apply(JsonTypeInfo) via System.Text.Json.JsonSerializerOptions.TypeInfoResolverChain to activate the attribute:
options.TypeInfoResolverChain.Add(
new DefaultJsonTypeInfoResolver { Modifiers = { JsonIgnoreNullsModifier.Apply } });Methods
JsonIgnoreNullsModifier.Apply(JsonTypeInfo) Method
A System.Text.Json.Serialization.Metadata.JsonTypeInfo modifier that sets ShouldSerialize to skip null values
on every nullable property of any type decorated with JsonIgnoreNullsAttribute.
public static void Apply(System.Text.Json.Serialization.Metadata.JsonTypeInfo typeInfo);Parameters
typeInfo System.Text.Json.Serialization.Metadata.JsonTypeInfo