Skip to content

Deprecate "exact values" setting from JsonNodeFactory, replace with JsonNodeFeature.STRIP_TRAILING_BIGDECIMAL_ZEROES #3651

@cowtowncoder

Description

@cowtowncoder

(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 JsonNodes to be logically equal for comparisons).

There are 2 main problems:

  1. Configurability by having to create and configure JsonNodeFactory is non-obvious and cumbersome
  2. 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:

  1. Add JsonNodeFeature.STRIP_TRAILING_BIGDECIMAL_ZEROES, to have precedence over other settings
  2. Leave JsonNodeFactory setting in place, deprecated
  3. Change code to do "normalization" in caller (JsonNodeDeserializer) NOT in JsonNodeFactory

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    node-configRelated to JSTEP-7 Node config/feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions