-
-
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
setSerializationInclusion(JsonInclude.Include.NON_EMPTY doesn't filter empty values from collections #4640
Comments
I believe JsonInclude only applies to beans and maps. |
Kind of: It does apply to |
Yeah, I noticed it. But I don't think that it's expected behavior that comes to ones mind when then learn about the "non_empty" option. I pathed the I believe it could be a more straightforward behavior having empty collection/array items filtered out in case of the "non_empty" option is provided. |
Changing this behavior would be major backwards-compatibility problem tho. So while I understand why it's confusing, I don't think this is something I want to change. |
No problem. I have my workaround implemented and it solves the problem we have. Feel free to close the issue. I'd suggest though leaving it open for comments, so I can share a relevant solution if anyone else has the same issue. Cheers, |
Will leave open for bit, close in future -- closed issued should be googlable still. |
Search before asking
Describe the bug
Empty Map values in collections don't get filtered out.
Version Information
2.17.2
Reproduction
Here is code for the corresponding unit test:
Expected behavior
It's expected that the test would pass.
Additional context
No response
The text was updated successfully, but these errors were encountered: