-
-
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
@JsonInclude(NON_DEFAULT) doesn't omit null fields #1351
Comments
I can reproduce the same problem if I replace the date with a |
I'd need more complete explanation to make sure I understand. But as to
So with global defaults, excluded value for double should be just Put another way, rules for |
Here is a minimal testcase for your review:
This outputs:
I am expecting it to output:
Does this help? |
@cowwoc Thanks, it does: result seems wrong to me indeed. For sake of completeness, I just released 2.8.2 yesterday, so maybe worth checking out. Otherwise I'll look into this when I get a chance. Thank you for reporting the issue. |
Just checked, 2.8.2 has the same behavior. Thanks for confirming this is a bug. |
Hmmh. I can see where this occurs but looks like solution may get trickier than I thought. |
Needed bit bigger changes than I hoped for, but this is now fixed for 2.8.3 and should reliably detect cases where |
This is not fixed for me. I have created a pull request #1416 with a modified version of the test @cowtowncoder added that still fails. |
Jackson 2.8.0
ObjectMapper.setSerializationInclusion(NON_DEFAULT)
.double
field and aLocalDate
field. The fields are set to0
andnull
respectively.null
date gets serialized but thedouble
gets omitted.I am expecting both fields to get omitted because both contain the type's default value.
The text was updated successfully, but these errors were encountered: