Skip to content

Serializing BigDecimal values inside containers ignores shape override #2519

@Woodz

Description

@Woodz

Using the config overrides described in #1911

Reproduction pseudocode:

class Foo {
  public BigDecimal value;
  public List<Object> values:
}

Foo foo = new Foo();
foo.value = new BigDecimal("1.23");
foo.values = ImmutableList.of(new BigDecimal("2.34"));

ObjectMapper mapper = new ObjectMapper();
mapper.configOverrides(BigDecimal.class). .setFormat(JsonFormat.Value.forShape(JsonFormat.Shape.STRING));
mapper.writeValueAsString(foo);

Expected:
Both BigDecimals to be JSON Strings

Actual:
Only value is JSON String

Version: 2.9.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions