<PackageReference Include="System.Text.Json" Version="6.0.0-preview.5.21301.5" />

JsonIgnoreCondition

public enum JsonIgnoreCondition
Controls how the JsonIgnoreAttribute ignores properties on serialization and deserialization.
Always = 1

Property will always be ignored.

Never = 0

Property will always be serialized and deserialized, regardless of IgnoreNullValues configuration.

Property will only be ignored if it is null.

If the value is null, the property is ignored during serialization. This is applied only to reference-type properties and fields.