-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ObjectMapper.setSerializationInclusion()
is ignored for JsonAnyGetter
#2592
Comments
Good question! My first instinct is that yes, it sounds like a bug. Any getters are bit special things and do not follow all the rules, mostly because technically they are not "real" properties, just a bag of key/value pairs serialized like properties. This presents a few practical challenges in making features that are based on properties (declarations in POJOs) work. But this particular aspect is probably possibly to support at least for overall definitions; and with some work, for any-getter annotations ( |
Fix will not work if filter is used as it triggers separate execution path.
Fix will not work if filter is used as it triggers separate execution path.
ObjectMapper.setSerializationInclusion()
is ignored for JsonAnyGetter
First of all: thank you a lot for an awesome library and tremendous work.
Description
I faced an issue while working with log4j2 JSON layout which uses Jackson. log4j2 JSON layout uses
JsonAnyGetter
to output context map. While.setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
is set on theObjectMapper
of log4j2 JSON layout, null and empty values of map are still present in output.This issue might be reproduced with plain Jackson:
On versions prior to
2.9.0
(my assumption - because of #1444) output is (I have tested on2.5.0
and2.8.11
):2.9.0+
(I have tested on both2.9.0
and2.10.2
):Question
Should this be considered a bug? If it is a bug which version should fix go? Should fix have backward-compatibility flag? Will you accept PR? I can try to prepare one.
Thanks.
P.S. might be related to #2289.
The text was updated successfully, but these errors were encountered: