I am wondering why there is not a determined way to work with Jackson
. I just want to parse JSON
string:
ObjectMapper mapper = new ObjectMapper();
Customer[] myObjects = mapper.readValue(file, Customer[].class);
But I really confused what should I import to do that. According to this link, I tried to import mapper-asl.jar
. But I get this compile error:
The type org.codehaus.jackson.JsonParser cannot be resolved. It is indirectly referenced from required .class files
Then I try to import jackson-core-2.4.2
and jackson-databind-2.4.2
. So there was no compile error but I got this runtime exception instead (in mapper definition line):
java.lang.NoClassDefFoundError: com.fasterxml.jackson.annotation.JsonAutoDetect
Guide me please what should I import to work with Jackson
. Thanks