<PackageReference Include="System.Text.Json" Version="6.0.8" />

JsonIgnoreCondition

public enum JsonIgnoreCondition
When specified on DefaultIgnoreCondition, determines when properties and fields across the type graph are ignored. When specified on Condition, controls whether a property or field is ignored during serialization and deserialization. This option overrides the setting on DefaultIgnoreCondition.
Always = 1

Property is always ignored during serialization and deserialization.

Never = 0

Property is never ignored during serialization or deserialization.

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

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