I am writing following code to convert my JSON sting to list of my object.
List<MyObject> myResponse = new ArrayList<MyObject>();
myResponse = new ObjectMapper().readValue(responseString, new TypeReference<List<MyObject>>(){});
But eclipse is complaining with following error:
The method readValue(String, Class<T>) in the type ObjectMapper is not applicable for the arguments (String, new TypeReference<List<MyObject>>(){})
What can be possible error?
Issue was with import of TypeReference. I was using
import com.fasterxml.jackson.core.type.TypeReference
instead of
import org.codehaus.jackson.type.TypeReference
For me the issue was with import of ObjectMapper. I was using
import com.fasterxml.jackson.core.type.ObjectMapper
instead of
import org.codehaus.jackson.type.ObjectMapper
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With