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;
}
模范改为json node之后,当时的田地为2e+3,但预计2000年。 页: 1