JsonIgnoreProperties not working
jackson
Solution
You've mixed different versions of Jackson. Notice that you import `JsonIgnoreProperties` from `org.codehaus.jackson.annotate` (version 1.x) while you're using `ObjectMapper` from `com.fasterxml.jackson.databind` (version 2.x).
Problem
I have the following simple class: ``` import org.codehaus.jackson.annotate.JsonIgnoreProperties; @JsonIgnoreProperties({ "thirdField" }) public class Message { private TypeA type; private String producer; //Getters and Setters } ``` in my test class ``` import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; public class Test { public void testMethd() { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(MapperFeature.USE_ANNOTATIONS, true); Class<T> instanceType = Message.class; String msgBody = "{\"producer\": \"clientApp\", \"type\": \"aType\", \"thirdField\": []}"; objectMapper.readValue(msgBody, instanceType); } } ``` All I am trying to do is to convert the above json string into Message class and ignore the 'thirdField'. But I keep getting ``` com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "thirdField" (class Message), not marked as ignorable (2 known properties: , "type", "producer"]) ```