I do not understand the question. Jackson will (de) serialize from / to the current version of Message POJO, which you defined in the original question, just fine, without errors, and without any special configurations (except @JsonProperty annotations). There is no successful field name in the current Message POJO, but it defines a property named success, so Jackson is happy to match the JSON example with it without any additional configurations. Do you want to remove @JsonProperty annotations?
If so, then you can do it, and Jackson still (de) serializes from / to Message POJO with the same JSON example without any other configurations, because the isSuccess and setSuccess method signatures already adequately determine that the Message has a property named success that matches the name of the element in JSON.
The following examples demonstrate these points.
Example 1 with a POJO message exactly as defined in the original question:
import java.util.HashMap; import java.util.Map; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.ObjectMapper; public class JacksonFoo { public static void main(String[] args) throws Exception {
Example 2 with a POJO message modified to remove @JsonProperty annotations.
import java.util.HashMap; import java.util.Map; import com.fasterxml.jackson.databind.ObjectMapper; public class JacksonFoo { public static void main(String[] args) throws Exception {
Example with MessageWrapper:
public class JacksonFoo { public static void main(String[] args) throws Exception {
source share