Return BigDecimal into JSON response looses decimal precision

While Returning BigDecimal value in API response (JSON), we loose precision value from the BigDecimal

Actual Result we got from API response in JSON
Screenshot from 2022-10-12 01-11-45

Expected Result from JSON output (API Response from Kotlin Rest)
Screenshot from 2022-10-12 01-12-52

(Assuming you use ‘.’ to separate every three digits and ‘,’ for the decimal point)
Well you might have lost a few digits but you didn’t lose any significant figures.
You won’t lose precision like this with Json. It’s just a matter of string formatting in your case.

1 Like

You have not specified how do you write and read values from Json. There are a lot of ways do so. And there are different ways to treat separators.

1 Like