when jackson deserialize the json into object, some of the optional fields (non `@Notnull`) could get a null value assigned, something like
//JSON
{
...
"field1": null
...
}
which would result into
class Payload{
String field1;
}
where when the payload object being used, it could throw out NPE if the field1
is not handled properly.
The way to handle this properly is through setting a default value during deserialization, something like
class Payload{
@JsonSetter(nulls=Nulls.SKIP)
String field1="DEFAULT-NULL";
}