-
-
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
Add JsonNodeFeature.USE_BIG_DECIMAL_FOR_FLOATS
to allow overriding DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS
#4801
Comments
@JooHyukKim If you looking for things to work on, here is one. |
Can we agree how the Can I suggest?
So if either DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS or JsonNodeFeature.USE_BIG_DECIMAL_FOR_FLOATS is true, then for JsonNode calculation, USE_BIG_DECIMAL_FOR_FLOATS is true. |
I concur @pjfanning |
Actually: one thing to consider -- So we should have six states, but basically if Ability to have "undefined" (or "default") is one improvement new |
@cowtowncoder I added undefined in #4801 (comment) -- does this make sense? |
@pjfanning almost but not quite (unless I misread it). What I think should happen is that since
So I think row 2 should be changed from
into
and otherwise table is ok. Does this make sense? |
Okay final?
|
Came up with #5058, seems easier than I thought 🤔 |
JsonNodeFeature
to allow overriding DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS
JsonNodeFeature.USE_BIG_DECIMAL_FOR_FLOATS
to allow overriding DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS
Describe your Issue
Due to eager binding of number type when reading
JsonNode
-- basically, decision must be made between reading:Double
vsBigDecimal
(to get either
DoubleNode
orBigDecimalNode
)there are cases where common buffering use cases expose unexpected precision loss -- particular since by default
Double
is used. See, for example:FasterXML/jackson-modules-java8#326
This behavior can be changed via
DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS
, but that is global setting. Instead, it would perhaps make sense to add aJsonNodeFeature
which would only affectJsonNode
reading, but would have precedence overDeserializationFeature
.I haven't thought this fully through wrt implementation but this seems like potentially useful thing to have.
The text was updated successfully, but these errors were encountered: