I'm getting the following error when using an ObjectMapper to de-serialize an object:
JSONMappingException Can not construct instance of org.springframework.data.Page, problem: abstract types can only be instantiated with additional type information.
I am trying to serialize a JSON string into a Spring data object org.springframework.data.Page which represents a page of type T.
The User class is a simple POJO with first and last name. The JSON string I am deserializing is:
{
    "content": [
        {
            "firstname": "John",
            "lastname": "Doe"
        },
        {
            "firstname": "Jane",
            "lastname": "Doe"
        }
    ],
    "size": 2,
    "number": 0,
    "sort": [
        {
            "direction": "DESC",
            "property": "timestamp",
            "ascending": false
        }
    ],
    "totalPages": 150,
    "numberOfElements": 100,
    "totalElements": 15000,
    "firstPage": true,
    "lastPage": false
}
This causes the exception:
Page<User> userPage = (Page<User>) new ObjectMapper().mapToJavaObject(json, new TypeReference<Page<User>>(){};
Since Page is a Spring object I cannot modify it which I think makes this a bit different from the way I see this question asked elsewhere. Any thoughts?