Jackson ObjectMapper throwing java.lang.ClassCastException: java.util.LinkedHashMap while deserializing generic type

I am trying to deserialize an Custom Generic Type class using Jackson ObjectMapper, but the test is throwing the following exception.I know the jackson api is not able to find the correct construct type, but i don't know what is the correct constrct type in my scenario. I tried with constructCollectionType & few others, but it is now working. So any help will be highly appreciated.

java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to com.test.CsSpace
    at java.util.ArrayList.forEach(ArrayList.java:1249)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)

here is the custom Generic Type class

@JsonIgnoreProperties(ignoreUnknown = true)
public class Response<T> {

    private int totalResults;
    private List<T> results;

    public int getTotalResults() {
        return totalResults;

    public void setTotalResults(int totalResults) {
        this.totalResults = totalResults;

    public List<T> getResults() {
        return results;

    public void setResults(List<T> results) {
        this.results = results;

One of the type is give below.

@JsonIgnoreProperties(ignoreUnknown = true)
public class Space {

    private String id;

    private String buildingId;

    //few more fields &its getter and setters

This is the main business logic deserializing the json

public <T> List<T> getEntity(ConnectorArg arg, String bearerToken, String path, Response<T> gt) throws IOException, ConnectorException {
        String token = BEARER+bearerToken;
        String url = hostName+path;
        ObjectMapper mapper = new ObjectMapper();
        Response res = ClientBuilder
                .header(Authorization, token)
        if(res.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL)) {
            CsSpaceResponse<T> csSpaceRes = mapper.readValue(res.readEntity(String.class), gt.getClass()); 
            //throws the exception above line. Tried mapper.readValue(res.readEntity(String.class), mapper.getTypeFactory().constructCollectionType(List.class, gt.getClass()));
            return csSpaceRes.getResults();
        }else {
            throw new ConnectorException("Exception while connecting to "+url);

Here is a sample of JSON I am trying to deserialize.

        "totalResults": 2,
        "results": [{
            "id": "1908",
            "Building_ID": "1234"
        }, {
            "id": "1909",
            "Building_ID": "12347"