Jackson is a multi-purpose Java library for processing JSON data format. In this example, file with data in JSON format is read using ObjectMapper class.

Jackson 2.x JAR Dependency

To serialize or unserialize JSON using Jackson 2.x requires following three jar files in classpath

  • Core – jackson-core-2.2.3.jar
  • Annotations – jackson-annotations-2.2.3.jar
  • Databind – jackson-databind-2.2.3.jar

Jackson 2.x JAR Download URL

Download Jackson 2.x Libraries

Jackson 2.x JAR Maven Dependency

Jackson Read JSON File to Java Object/POJO Example

JacksonExample.java

Reads JSON format File, deserializes JSON format and binds values to User class object using ObjectMapper class.

User.java

User Java Bean Object/POJO.

Example Output

Content of “C:/temp/json-file.txt” file.

Log output after execution.