0

Using jackson 2.11, trying to convert java object to JsonNode and it returns scientific notation of Bigdecimal value. Bigdecimal value - 2000.0, returns scientific value 2e+3 instead I need 2000.0

private final ObjectMapper objectMapper = new ObjectMapper();
EmpDto emp = new EmpDto();
emp.setId = "1024";
emp.setEmpName = "Test";
emp.setEmpSal = BigDecimal.valueOf(2000.0)
  JsonNode source = objectMapper.valueToTree(emp);

 @Data
public class EmpDto {
    private String empId;
    private String empName;
    private BigDecimal empSal;
  
}
  

After converting emp to json node, empSal field has 2e+3 but expecting 2000.0

raj
  • 11
  • 4

0 Answers0