I Have a class like this ;
public class User {
public String username;
public String password;
}
json
{"username": "test","password": [1,2,3,4,5,6,7,8,8,9]}
When I run this code ;
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
User user = objectMapper.readValue(json, User.class);
It throw an exception;
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.lang.String` from Array value (token `JsonToken.START_ARRAY`)
But I just want get a user like this;
username=test;
password=null;
What should I do?