Search code examples
javajacksonobjectmapper

can't create an objectMapper in java


I am creating an instance of the object mapper.

ObjectMapper objectMapper = new ObjectMapper();

This line gives me the following error:

The constructor ObjectMapper() is undefined

What am I doing wrong? Can you please help me? Thanks in advance.


Solution

  • You might be missing the below jar if you are using Jackson

    jackson-mapper-asl-1.5.0.jar
    

    Also try importing below package

    import com.fasterxml.jackson.databind.*;