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
Jackson allows skip null values when serializing maps. This doesn't work, when map value is generated by the method annotated with @JsonValue. For example:
This will be tricky one to resolve because code that handles inclusion rules will not see null but the POJO, and translation to null occurs later... when property name was already been written. This means that it is unlikely to be fixed for 2.1, as it will require bigger change.
Come to think of this, I do not think this is supportable as defined.
Since actual values are not nulls, they will not be blocked by NON_NULL. Jackson 2.9 will support custom inclusion rules (see @JsonInclude and specifically content and new contentFilter).
Without this, an alternative would be custom serializer for SomeClass, which may define isEmpty() method; and if properly defined could then used NON_EMPTY to remove such entries.
But the trick is that determination MUST be based on Java value -- instance of SomeClass -- and not on whatever @JsonValue accessor may convert it to.
(note: moved from FasterXML/jackson-core#50)
Jackson allows skip null values when serializing maps. This doesn't work, when map value is generated by the method annotated with @JsonValue. For example:
and:
result:
The text was updated successfully, but these errors were encountered: