ReadValue () doesn't work with TypeReference
I am writing the following code to convert my JSON sting to a list of my object.
List<MyObject> myResponse = new ArrayList<MyObject>();
myResponse = new ObjectMapper().readValue(responseString, new TypeReference<List<MyObject>>(){});
But eclipse is complaining about the following error:
The method readValue(String, Class<T>) in the type ObjectMapper is not applicable for the arguments (String, new TypeReference<List<MyObject>>(){})
What could be the mistake?
+3
source to share
2 answers