Java 17 JsonMappingException When Deserializing Nested Objects with Jackson
I'm attempting to set up I'm trying to configure I'm working with a `JsonMappingException` while trying to deserialize a JSON response into a nested Java object structure using Jackson in Java 17. The JSON looks like this: ```json { "user": { "id": 1, "name": "John Doe", "address": { "street": "123 Main St", "city": "Anytown" } } } ``` I have the following classes defined for deserialization: ```java public class User { private int id; private String name; private Address address; // Getters and Setters } public class Address { private String street; private String city; // Getters and Setters } ``` When I attempt to deserialize this JSON using the following code: ```java ObjectMapper objectMapper = new ObjectMapper(); User user = objectMapper.readValue(jsonString, User.class); ``` I receive the following behavior: ``` com.fasterxml.jackson.databind.JsonMappingException: want to construct instance of `User`, question: want to deserialize value of type `int` from String "1": not a valid Integer value ``` I've confirmed that the JSON is correctly formatted and the types in my Java classes seem to match. Additionally, I've tried adding the `@JsonProperty` annotation to the fields in the `User` class, but the behavior continues. I also ensured that I have the correct Jackson dependencies in my `pom.xml`: ```xml <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.13.3</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.13.3</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>2.13.3</version> </dependency> ``` Is there something I'm missing with the way Jackson handles types or nested objects in Java 17? Any pointers or solutions would be greatly appreciated! My development environment is Ubuntu. Any ideas what could be causing this? I've been using Java for about a year now. I'm developing on Debian with Java. Thanks for your help in advance!