I am understanding below JSON
{ "id": "1", "value": "some value" }
{ "id": "2", "value": null }
{ "id": "3" }
To hold the above JSON data I have java class :
class myClass
{
private String id;
private String value;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
In above example : id 2 and id 3 both have value as NULL
In java it is very difficult to identify the distinguish between passed null value in JSON and other field which are not passed hence java pojo has its default value as NULL.
For me value of id 2 & id 3 should not be same.
Is it possible to distinguish between provided JSON NULL & and default NULL in java?