-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Change of NON_EMPTY
for Scalars (Fix #849) in 2.6 is not backward compatible
#875
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
Comments
👍 why don't you use NON_DEFAULT instead of NON_EMPTY? |
@mastojun Concept of "empty" is arbitrary, but it does not mean "missing". @kamenik Change was to address behavior, since zero was supposed to have been taken as empty from beginning; similar to empty String "" or boolean I am open to other ways to correct the problem however. |
@mastojun One more thing: while However: for primitives it should actually also work; so you can use settings interchangably. I will need to at least upgrade javadocs for |
I've tried using both NON_NULL and NON_ABSENT but this changes other behavior that breaks unit tests for us. @cowtowncoder Is there a way to set SerializationInclusion on a specific type, namely numbers? |
+1 to this issue: IMHO this will be counterintuitive even if you will mention this behaviour in docs |
Regardless, the original intent was to consider default values for numbers to be empty. But the problem is that there is legitimate need/preference to also suppress zero numeric values, usually to reduce size of JSON serialization. Use of Further, given that 2.6 does have clarified behavior, I am not sure I would want to make yet another behavior change in 2.7 to roll back changes. With all this, note that there is not much benefit to +1:ing this issue -- issue tracker is not followed up by all (or even many) developers. The better place to argue for change in behavior is Jackson developer list at |
NON_EMPTY
for Scalars (Fix #849) in 2.6 is not backward compatible
Fixed via #952, included in 2.7.0-rc2. |
Hi,
We have upgraded to Jackson 2.6.0 recently and it broke lots of our javascripts, they are very surprised by all zero values changed to undefined. It would be better to add another flag (NON_EMPTY_OR_ZERO) instead of changing current functionality.
The text was updated successfully, but these errors were encountered: