Skip to content

USE_BIG_DECIMAL_FOR_FLOATS feature not working when using JSON.treeFrom() #90

@jvdsandt

Description

@jvdsandt

This test fails because the USE_BIG_DECIMAL_FOR_FLOATS feature is ignored and Double objects are stiill used.

@Test
public void testParseDecimals() throws Exception {

    JSON json = JSON.builder()
            .treeCodec(new JacksonJrsTreeCodec())
            .enable(JSON.Feature.USE_BIG_DECIMAL_FOR_FLOATS)
            .build();

    String input = "[1.1]";

    TreeNode node = json.treeFrom(input);
    TreeNode elemNode = node.get(0);

    assertTrue(elemNode instanceof JrsNumber);
    assertTrue(((JrsNumber) elemNode).getValue() instanceof BigDecimal);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions