Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The issue with using java Gson().fromJson to assign BigDecimal values is that Gson by default converts all numeric values to double, which cannot hold the precision of a BigDecimal. This may lead to the loss of precision, which is not desirable in financial calculations. To avoid this issue, Gson provides a custom TypeAdapter for BigDecimal that can be used to deserialize the values correctly.