Suppose I have an ie class
private class Student { private Integer x = 1000; public Integer getX() { return x; } public void setX(Integer x) { this.x = x; } }
Now suppose json is "{x:12}" and is deserializing, then x will be 12 . But if json is "{}" , then the value is x = 1000 (get from the default value of the attribute declared in the class).
Now, if json is "{x:null}" , then the x value becomes null , but here even in this case I want the x value to be 1000 . How to do it through jackson . Thanks in advance.
I will deserialize the method below if that helps anyway: objectMapper.readValue(<json string goes here>, Student.class);
java json jackson
Trying
source share