Skip to content
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

Consider adding JsonNodeFeature to allow overriding DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS #4801

Open
cowtowncoder opened this issue Nov 19, 2024 · 0 comments
Labels
2.19 Issues planned at 2.19 or later

Comments

@cowtowncoder
Copy link
Member

Describe your Issue

Due to eager binding of number type when reading JsonNode -- basically, decision must be made between reading:

  1. Slightly faster, but potentially lossy Double vs
  2. Bit slower but unlimited range/precision BigDecimal

(to get either DoubleNode or BigDecimalNode)

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 a JsonNodeFeature which would only affect JsonNode reading, but would have precedence over DeserializationFeature.

I haven't thought this fully through wrt implementation but this seems like potentially useful thing to have.

@cowtowncoder cowtowncoder added the 2.19 Issues planned at 2.19 or later label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.19 Issues planned at 2.19 or later
Projects
None yet
Development

No branches or pull requests

1 participant