Back to Practical Aspnetcore

Control JsonIgnore behavior.

projects/json/json-10/README.md

latest756 B
Original Source

Control JsonIgnore behavior.

  • [JsonIgnore]. This tells the serializer not to generate the property in the output JSON document.
    • [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]. This tells serializer to not generate the property when it has null value.
    • [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]. This tells serializer to not generate the property if it has default value.
    • [JsonIgnore(Condition = JsonIngoreCondition.Never)]. This tells serializer to always generate the property regardless of the options set at JsonSerializerOptions.
    • [JsonIgnore(Condition = JsonIngoreCondition.Always)]. This tells serializer to always not generate the property. This is the default behaviour.