Avatar ·

Jackson: Unrecognized field, not marked as ignorable — how to fix the error?

Hi everyone! I'm new to Java and trying to parse JSON into an object using the Jackson library. I have a POJO class `User` with fields `name` and `email`, but the JSON coming from an external API contains an additional field `age`. When I try to execute `ObjectMapper.readValue()`, I get an exception: ``` com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "age" (class User), not marked as ignorable (2 known properties: "name", "email"]) ``` Here is my code: ```java public class User { private String name; private String email; // getters and setters } public class Main { public static void main(String[] args) throws Exception { String json = "{\"name\":\"John\", \"email\":\"john@example.com\", \"age\":30}"; ObjectMapper mapper = new ObjectMapper(); User user = mapper.readValue(json, User.class); } } ``` Why does Jackson complain about the `age` field if I didn't declare it? How to properly