Skip to content

Bug: BigDecimal serialized with comma as decimal divider #319

@Simulant87

Description

@Simulant87

when I execute the Test org.eclipse.yasson.documented.DocumentationExampleTest#testDateNumberFormats1 on my local system, it fails because the BigDecimal gets serialized to 123,46 instead of 123.46 containing a comma instead of a dot as decimal divider.

This might be caused by the default localization settings (german) of my local system in combination with the used test class adding a Numberformat to the field @JsonbNumberFormat("#0.00"), but I would expect the test still not to fail depending on my local settings.

I think it is a bug as the JSON specification only allows the dot . as decimal dot and not the comma , referencing to the number section https://tools.ietf.org/html/rfc7159#section-6
So the BigDecimal 123.46 should never, even not with my german local settings get serialized to 123,46 as this results in invalid JSON.

Full JUnit output of the test org.eclipse.yasson.documented.DocumentationExampleTest#testDateNumberFormats1

org.junit.ComparisonFailure: 
Expected :{"birthDate":"07.08.1999","name":"Jason Bourne","salary":"123.46"}
Actual   :{"birthDate":"07.08.1999","name":"Jason Bourne","salary":"123,46"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions