-
-
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
Combination of @JsonUnwrapped
and @JsonAnySetter
results in BigDecimal
instead of Double
#3277
Comments
Workaround:
|
Looks to be caused by the fix for #2644. For that fix, the TokenBuffer buffers the exact value because the necessary precision can't be determined beforehand (the target type might turn out to be Not sure if changing back to double downstream is a good idea. After all, the main reason for |
True, however, code does sort of expect a double since USE_BIG_DECIMAL_FOR_FLOATS is set to false, so it was a bit surprising to see values, which used to be doubles, change to BigDecimal because of a structural change (using JsonUnwrapped/JsonAnySetter). The work-around is fine for now, but I would think that when filling these values it should check the USE_BIG_DECIMAL_FOR_FLOATS setting and convert them back to doubles if it is set to false (or some other solution which avoids this in the first place obviously, but since there is some buffering involved that might be hard... Perhaps it would have been a good idea to not do any interpretation in the TokenBuffer (leave it as strings/text) but I have insufficient knowledge of the internal workings of Jackson to say if that is a good idea or not. |
Quick note: this ( The problem is tricky to solve for a few reasons. Basically:
So. Alas, it's a tricky problem altogether. |
We ran into this issue when upgrading to 2.12 and I see that it is also not fixed in 2.13. |
Any update on this issue? |
@seadbrane do you want to try Jackson 2.16.0 yourself? There have been some changes in number handling. This issue was not addressed directly but it's possible the behaviour has changed due to the other number changes in Jackson. |
@pjfanning was right on point. It works now. Please take a look at the #4259? @seadbrane 👍🏼 |
Yes, not able to repro anymore either. Thanks for the update. |
@JsonUnwrapped
and @JsonAnySetter
results in BigDecimal
instead of Double
Describe the bug
When deserializing a float value to a structure nested in JsonUnwrapped and JsonAnySetter, the float value becomes a BigDecimal instead of Double (USE_BIG_DECIMAL_FOR_FLOATS is left to its default setting).
Version information
2.12.4
To Reproduce
Expected behavior
Would still expect a Double here.
The text was updated successfully, but these errors were encountered: