Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigDecimal is serialized incorrectly #297

Closed
LuckySpb opened this issue Jun 23, 2016 · 1 comment
Closed

BigDecimal is serialized incorrectly #297

LuckySpb opened this issue Jun 23, 2016 · 1 comment
Labels

Comments

@LuckySpb
Copy link

LuckySpb commented Jun 23, 2016

BigDecimal with floating point is serialized to json incorrectly with JacksonMapper.
If I use pure fasterxml new ObjectMapper() json is produced correctly.

        Document doc = new Document();
        doc.put("BigDecimal", new BigDecimal(1.099d));
        doc.put("Double", 1.099d);
        Mapper mapper = new JacksonMapper.Builder().build();
        Jongo jongo = new Jongo(db, mapper);
        MongoCollection collection = jongo.getCollection("bd.test");
        collection.insert(doc);

results in
{ "_id" : ObjectId("576ae1e0ceb5a93d06bf4991"), "BigDecimal" : 1.09899997711182, "Double" : 1.099, }

There is no SerializationFeature available to control how BigDecimal is serialized to json

@github-actions
Copy link

github-actions bot commented Mar 3, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Mar 3, 2021
@github-actions github-actions bot closed this as completed Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant