java - Setting default values to null fields when mapping with Jackson - Stack Overflow
I am trying to map some JSON objects to Java objects with Jackson. Some of the fields in the JSON object are mandatory(which I can mark with @NotNull
) and some are optional.
After the mapping with Jackson, all the fields that are not set in the JSON object will have a null value in Java. Is there a similar annotation to @NotNull
that can tell Jackson to set a default value to a Java class member, in case it is null?
Read full article from java - Setting default values to null fields when mapping with Jackson - Stack Overflow
No comments:
Post a Comment