Is there an attribute to prevent Jil from serializing properties that are null ?
In Newtonsoft it is :
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
Is there an attribute to prevent Jil from serializing properties that are null ?
In Newtonsoft it is :
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
Copyright © 2021 Jogjafile Inc.
For the whole object, the
excludeNullsparameter onOptionsis what you want (many different Options configurations are pre-calced, anything likeOptions.ExcludeNullsalso works).You can control serialization of a single property with Conditional Serialization. (I forgot about this option in my original answer).
For example
Jil only respects the
Nameoption on[DataMember]. I suppose honoringEmitDefaultValuewouldn't be the hardest thing, but nobody's ever opened an issue for it.