gitmyhub

jackson-databind

Java ★ 3.7k updated 13h ago

General data-binding package for Jackson: works on streaming API (core) implementation(s)

The most widely used Java library for converting between Java objects and JSON, with a simple ObjectMapper API for reading JSON strings into your classes and writing your objects back to JSON.

JavaMavenGradlesetup: easycomplexity 2/5

Jackson Databind is the core data-binding library for the Jackson project, which is one of the most widely used JSON processing tools in the Java ecosystem. Its main job is converting between Java objects and JSON text in both directions: reading a JSON string or file into a Java object, and writing a Java object back out as JSON.

The central class is ObjectMapper. You create one instance (typically once per application), then call readValue to parse JSON into a Java class you define, and writeValueAsString or writeValue to turn a Java object into JSON. Java objects that Jackson works with are plain Java classes with fields and optional getters and setters, often called POJOs (Plain Old Java Objects). You annotate fields or classes when you need to customize how the mapping works, using a companion library called Jackson Annotations.

Beyond simple object conversion, Jackson Databind supports Java collections like Lists and Maps, handles generic types, and offers a Tree Model where JSON is parsed into a generic node structure rather than a specific Java class. The Tree Model is useful when the JSON shape is not known ahead of time or does not map cleanly to a fixed class.

While the library originated as a JSON tool, it is designed to work with other data formats too, such as XML, CSV, or YAML, as long as the appropriate parser and generator implementations are available. The class and package names still reference JSON for historical reasons, but there is no hard dependency on JSON specifically.

Jackson Databind is distributed through Maven Central and is available as a standard Maven or Gradle dependency. Version 2.x requires JDK 8 or higher; version 3.x requires JDK 17 or higher. The library is licensed under Apache License 2.0.

Where it fits