in the previous asp.net framework, we can use nullvaluehandling
(json.net) to ignore the null JSON value.
but now in asp.net core, it's starting using system.text.json. how can I set null value handling using this library?
thanks
in the previous asp.net framework, we can use nullvaluehandling
(json.net) to ignore the null JSON value.
but now in asp.net core, it's starting using system.text.json. how can I set null value handling using this library?
thanks
In System.Text.Json 5.x:
new JsonSerializerOptions() { IgnoreNullValues = true }
It became obsolete in 6.x and now this should be used:
new JsonSerializerOptions() { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull }