-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
(note: follow-up to #3650)
With Jackson 2.x there is a setting in JsonNodeFactory
that determines whether BigDecimal
values are normalized upon read (default) or not. Default value of normalization seems surprising to users, but there is a use-case for normalization too (specifically, trying to normalize JsonNode
s to be logically equal for comparisons).
There are 2 main problems:
- Configurability by having to create and configure
JsonNodeFactory
is non-obvious and cumbersome - Default to normalization seems unexpected by many users.
Changing 2 would be easy, but changes behavior so will need to wait either until 3.0, or at least 2.16 if and when the other part goes in 2.15.
So let's:
- Add
JsonNodeFeature.STRIP_TRAILING_BIGDECIMAL_ZEROES
, to have precedence over other settings - Leave
JsonNodeFactory
setting in place, deprecated - Change code to do "normalization" in caller (
JsonNodeDeserializer
) NOT inJsonNodeFactory
This allows users to migrate to using JsonNodeFeature.STRIP_TRAILING_BIGDECIMAL_ZEROES
for configurability while retaining old behavior for old code.
We can then consider default changes for a later version, separately.