You need to use a TypeToken
to correctly express the type. Class
is not sufficient in this case, because of the interaction with the generic type.
Type listType = new TypeToken<List<Foo>>(){}.getType();
List<Foo> projects = (List<Foo>) gson.fromJson(response, listType);