Top Description Interfaces Classes Enums
module jackson.databind

Package com.fasterxml.jackson.databind


Basic data binding (mapping) functionality that allows for reading JSON content into Java Objects (POJOs) and JSON Trees (com.fasterxml.jackson.databind.JsonNode), as well as writing Java Objects and trees as JSON. Reading and writing (as well as related additional functionality) is accessed through com.fasterxml.jackson.databind.ObjectMapper, com.fasterxml.jackson.databind.ObjectReader and com.fasterxml.jackson.databind.ObjectWriter classes. In addition to reading and writing JSON content, it is also possible to use the general databinding functionality for many other data formats, using Jackson extension modules that provide such support: if so, you typically simply construct an com.fasterxml.jackson.databind.ObjectMapper with different underlying streaming parser, generator implementation.

The main starting point for operations is com.fasterxml.jackson.databind.ObjectMapper, which can be used either directly (via multiple overloaded readValue, readTree, writeValue and writeTree methods, or it can be used as a configurable factory for constructing fully immutable, thread-safe and reusable com.fasterxml.jackson.databind.ObjectReader and com.fasterxml.jackson.databind.ObjectWriter objects.

In addition to simple reading and writing of JSON as POJOs or JSON trees (represented as com.fasterxml.jackson.databind.JsonNode, and configurability needed to change aspects of reading/writing, mapper contains additional functionality such as:

Simplest usage is of form:

  final ObjectMapper mapper = new ObjectMapper(); // can use static singleton, inject: just make sure to reuse!
  MyValue value = new MyValue();
  // ... and configure
  File newState = new File("my-stuff.json");
  mapper.writeValue(newState, value); // writes JSON serialization of MyValue instance
  // or, read
  MyValue older = mapper.readValue(new File("my-older-stuff.json"), MyValue.class);

  // Or if you prefer JSON Tree representation:
  JsonNode root = mapper.readTree(newState);
  // and find values by, for example, using a com.fasterxml.jackson.core.JsonPointer expression:
  int age = root.at("/personal/age").getValueAsInt();

For more usage, refer to com.fasterxml.jackson.databind.ObjectMapper, com.fasterxml.jackson.databind.ObjectReader and com.fasterxml.jackson.databind.ObjectWriter Javadocs.

Interface Summary

Modifier and TypeInterface and Description
public interface
BeanProperty

Bean properties are logical entities that represent data that Java objects (POJOs (Plain Old Java Objects), sometimes also called "beans") contain; and that are accessed using accessors (methods like getters and setters, fields, constructor parameters).

public interface
EnumNamingStrategy

Defines how the string representation of an enum is converted into an external property name for mapping during deserialization.

public interface
JsonSerializable

Interface that can be implemented by objects that know how to serialize themselves to JSON, using JsonGenerator (and SerializerProvider if necessary).

Class Summary

Modifier and TypeClass and Description
public abstract class
AbstractTypeResolver

Defines interface for resolvers that can resolve abstract types into concrete ones; either by using static mappings, or possibly by materializing implementations dynamically.

public abstract class
AnnotationIntrospector

Abstract class that defines API used for introspecting annotation-based configuration for serialization and deserialization.

public abstract class
BeanDescription

Basic container for information gathered by ClassIntrospector to help in constructing serializers and deserializers.

public abstract class
DatabindContext

Shared base class for DeserializationContext and SerializerProvider, context objects passed through data-binding process.

public abstract class
DatabindException

Intermediate base class for all databind level processing problems, as distinct from stream-level problems or I/O issues below.

public class
DeserializationConfig

Object that contains baseline configuration for deserialization process.

public abstract class
DeserializationContext

Context for the process of deserialization a single root-level value.

public class
EnumNamingStrategies

A container class for implementations of the EnumNamingStrategy interface.

public abstract class
InjectableValues

Abstract class that defines API for objects that provide value to "inject" during deserialization.

public abstract class
JavaType

Base class for type token classes used both to contain information and as keys for deserializers.

public abstract class
JsonDeserializer<T>

Abstract class that defines API used by ObjectMapper (and other chained JsonDeserializers too) to deserialize Objects of arbitrary types from JSON, using provided JsonParser.

public class
JsonMappingException

Checked exception used to signal fatal problems with mapping of content, distinct from low-level I/O problems (signaled using simple java.io.IOExceptions) or data encoding/decoding problems (signaled with com.fasterxml.jackson.core.exc.StreamReadException, com.fasterxml.jackson.core.exc.StreamWriteException).

public abstract class
JsonNode

Base class for all JSON nodes, which form the basis of JSON Tree Model that Jackson implements.

public abstract class
JsonSerializer<T>

Abstract class that defines API used by ObjectMapper (and other chained JsonSerializers too) to serialize Objects of arbitrary types into JSON, using provided JsonGenerator.

public abstract class
KeyDeserializer

Abstract class that defines API used for deserializing JSON content field names into Java Map keys.

public class
MappingIterator<T>

Iterator exposed by ObjectMapper when binding sequence of objects.

public class
MappingJsonFactory

Sub-class of JsonFactory that will create a proper ObjectCodec to allow seam-less conversions between JSON content and Java objects (POJOs).

public abstract class
Module

Simple interface for extensions that can be registered with ObjectMapper to provide a well-defined set of extensions to default functionality; such as support for new data types.

public class
ObjectMapper

ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Plain Old Java Objects), or to and from a general-purpose JSON Tree Model (JsonNode), as well as related functionality for performing conversions.

public class
ObjectReader

Builder object that can be used for per-serialization configuration of deserialization parameters, such as root type to use or object to update (instead of constructing new instance).

public class
ObjectWriter

Builder object that can be used for per-serialization configuration of serialization parameters, such as JSON View and root type to use.

public class
PropertyMetadata

Simple container class used for storing "additional" metadata about properties.

public class
PropertyName

Simple value class used for containing names of properties as defined by annotations (and possibly other configuration sources).

public abstract class
PropertyNamingStrategies

Container for standard PropertyNamingStrategy implementations and singleton instances.

public class
PropertyNamingStrategy

Class that defines how names of JSON properties ("external names") are derived from names of POJO methods and fields ("internal names"), in cases where no explicit annotations exist for naming.

public class
RuntimeJsonMappingException

Wrapper used when interface does not allow throwing a checked JsonMappingException

public class
SequenceWriter

Writer class similar to ObjectWriter, except that it can be used for writing sequences of values, not just a single value.

public class
SerializationConfig

Object that contains baseline configuration for serialization process.

public abstract class
SerializerProvider

Class that defines API used by ObjectMapper and JsonSerializers to obtain serializers capable of serializing instances of specific types; as well as the default implementation of the functionality.

Enum Summary

Modifier and TypeEnum and Description
public enum
DeserializationFeature

Enumeration that defines simple on/off features that affect the way Java objects are deserialized from JSON

Note that features can be set both through ObjectMapper (as sort of defaults) and through ObjectReader.

public enum
MapperFeature

Enumeration that defines simple on/off features to set for ObjectMapper, and accessible (but not changeable) via ObjectReader and ObjectWriter (as well as through various convenience methods through context objects).

public enum
SerializationFeature

Enumeration that defines simple on/off features that affect the way Java objects are serialized.