You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tried to override null-ignore behavior on some individual cases where it makes sense, but no such luck.
My reasonable expectation is that if a property has converter specified (and converter gets the converter options), then the converter would be called on all and any values that the property is. However the IgnoreNullValue = true causes the converter to never be called and to be unable to make the decision in application.
We currently don't pass null to user converters, so even if IgnoreNullValues was false in your scenario, the converter's write method would still not be called. For 5.0, we are likely to add a bool property on JsonConverter (as part of work in #1562), say HandleNullValues (defaults to false) for converter's to opt in to handle null tokens. cc @steveharter.
New semantics need to be added for a property not to be ignored when IgnoreNullValues is true. This seems like a good candidate for the Never condition on the new JsonIgnoreCondition property being proposed in #30687. Your class definition could look like this:
Closing as duplicate - #34439 tracks providing an opt-in for converters to handle null, and properties can be excluded from being ignored using JsonIgnoreCondition.Never introduced in #30687.
Tried to override null-ignore behavior on some individual cases where it makes sense, but no such luck.
My reasonable expectation is that if a property has converter specified (and converter gets the converter options), then the converter would be called on all and any values that the property is. However the
IgnoreNullValue = true
causes the converter to never be called and to be unable to make the decision in application.example:
The text was updated successfully, but these errors were encountered: