Top Description Inners Fields Constructors Methods
tools.jackson.databind

public Class ObjectMapper

extends Object
implements TreeCodec, Versioned, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, tools.jackson.core.Versioned, tools.jackson.core.TreeCodec
Known Direct Subclasses
tools.jackson.databind.json.JsonMapper
Imports
java.io.*, java.lang.reflect.Type, java.nio.file.Path, java.text.DateFormat, java.util.Collection, .List, .Map, java.util.concurrent.ConcurrentHashMap, java.util.concurrent.atomic.AtomicReference, tools.jackson.core.*, tools.jackson.core.exc.JacksonIOException, .StreamReadException, tools.jackson.core.io.CharacterEscapes, .SegmentedStringWriter, tools.jackson.core.json.JsonFactory, tools.jackson.core.type.ResolvedType, .TypeReference, tools.jackson.core.util.*, tools.jackson.databind.cfg.*, tools.jackson.databind.deser.DeserializationContextExt, tools.jackson.databind.exc.MismatchedInputException, tools.jackson.databind.introspect.*, tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper, tools.jackson.databind.jsontype.SubtypeResolver, tools.jackson.databind.node.*, tools.jackson.databind.ser.*, tools.jackson.databind.type.*, tools.jackson.databind.util.ClassUtil, .RootNameLookup, .TokenBuffer

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. In addition to directly reading and writing JSON (and with different underlying TokenStreamFactory configuration, other formats), it is also the mechanism for creating ObjectReaders and ObjectWriters which offer more advancing reading/writing functionality.

Construction of mapper instances proceeds either via no-arguments constructor (producing instance with default configuration); or through one of two build methods. First build method is the static builder() on exact type and second rebuild() method on an existing mapper. Former starts with default configuration (same as one that no-arguments constructor created mapper has), and latter starts with configuration of the mapper it is called on. In both cases, after configuration (including addition of JacksonModules) is complete, instance is created by calling MapperBuilder#build() method.

Mapper (and ObjectReaders, ObjectWriters it constructs) will use instances of JsonParser and JsonGenerator for implementing actual reading/writing of JSON. Note that although most read and write methods are exposed through this class, some of the functionality is only exposed via ObjectReader and ObjectWriter: specifically, reading/writing of longer sequences of values is only available through ObjectReader#readValues(InputStream) and ObjectWriter#writeValues(OutputStream).

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 tools.jackson.core.JsonPointer expression:
  int age = root.at("/personal/age").getValueAsInt();

Mapper instances are fully thread-safe as of Jackson 3.0.

Note on caching: root-level deserializers are always cached, and accessed using full (generics-aware) type information. This is different from caching of referenced types, which is more limited and is done only for a subset of all deserializer types. The main reason for difference is that at root-level there is no incoming reference (and hence no referencing property, no referral information or annotations to produce differing deserializers), and that the performance impact greatest at root level (since it'll essentially cache the full graph of deserializers involved).

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
ObjectMapper.PrivateBuilder

Base implementation for "Vanilla" ObjectMapper, only defined to support backwards-compatibility with some of 2.x usage patterns.

Field Summary

Modifier and TypeField and Description
protected final DeserializationConfig
_deserializationConfig

Configuration object that defines basic global settings for the serialization process

protected final DeserializationContexts
_deserializationContexts

Factory used for constructing per-call DeserializationContexts.

protected final InjectableValues
_injectableValues

Provider for values to inject in deserialized POJOs.

protected final ConcurrentHashMap<JavaType, ValueDeserializer<Object>>
_rootDeserializers

We will use a separate main-level Map for keeping track of root-level deserializers.

protected final MapperBuilderState
_savedBuilderState

Minimal state retained to allow both re-building (by creating new builder) and JDK serialization of this mapper.

protected final SerializationConfig
_serializationConfig

Configuration object that defines basic global settings for the serialization process

protected final SerializationContexts
_serializationContexts

Factory used for constructing per-call SerializationContexts.

protected final TokenStreamFactory
_streamFactory

Factory used to create JsonParser and JsonGenerator instances as necessary.

protected final TypeFactory
_typeFactory

Specific factory used for creating JavaType instances; needed to allow modules to add more custom type handling (mostly to support types of non-Java JVM languages)

private static final JavaType
private static final long

Constructor Summary

AccessConstructor and Description
public
ObjectMapper()

Default constructor, which will construct the default JSON-handling TokenStreamFactory as necessary and all other unmodified default settings, and no additional registered modules.

public
ObjectMapper(TokenStreamFactory streamFactory)

Constructs instance that uses specified TokenStreamFactory for constructing necessary JsonParsers and/or JsonGenerators, but without registering additional modules.

protected
ObjectMapper(MapperBuilder<?, ?> builder)

Constructor usually called either by MapperBuilder#build or by sub-class constructor: will get all the settings through passed-in builder, including registration of any modules added to builder.

Method Summary

Modifier and TypeMethod and Description
protected final void
_assertNotNull(String paramName, Object src)

private final void
_configAndWriteCloseable(SerializationContextExt prov, JsonGenerator g, Object value)

Helper method used when value to serialize is Closeable and its close() method is to be called right after serialization has been called

protected final void
_configAndWriteValue(SerializationContextExt prov, JsonGenerator g, Object value)

Method called to configure the generator as necessary and then call write functionality

protected Object
_convert(Object fromValue, JavaType toValueType)

Actual conversion implementation: instead of using existing read and write methods, much of code is inlined.

protected DeserializationContextExt
_deserializationContext(JsonParser p)

Internal helper method called to create an instance of DeserializationContext for deserializing a single root value.

public DeserializationContextExt
protected DeserializationContextExt
protected ValueDeserializer<Object>
_findRootDeserializer(DeserializationContext ctxt, JavaType valueType)

Method called to locate deserializer for the passed root-level value.

protected JsonToken

Returns:

First token to be used for data binding after this call: can never be null as exception will be thrown if parser cannot provide more tokens.
_initForReading
(JsonParser p, JavaType targetType)

Method called to ensure that given parser is ready for reading content for data binding.

protected ObjectReader
_newReader(DeserializationConfig config)

Factory method sub-classes must override, to produce ObjectReader instances of proper sub-type

protected ObjectReader
_newReader(DeserializationConfig config, JavaType valueType, Object valueToUpdate, FormatSchema schema, InjectableValues injectableValues)

Factory method sub-classes must override, to produce ObjectReader instances of proper sub-type

protected ObjectWriter
_newWriter(SerializationConfig config)

Factory method sub-classes must override, to produce ObjectWriter instances of proper sub-type

protected ObjectWriter
_newWriter(SerializationConfig config, FormatSchema schema)

Factory method sub-classes must override, to produce ObjectWriter instances of proper sub-type

protected ObjectWriter
_newWriter(SerializationConfig config, JavaType rootType, PrettyPrinter pp)

Factory method sub-classes must override, to produce ObjectWriter instances of proper sub-type

protected Object
protected JsonNode
_readTreeAndClose(DeserializationContextExt ctxt, JsonParser p0)

Similar to _readMapAndClose but specialized for JsonNode reading.

protected Object
_readValue(DeserializationContextExt ctxt, JsonParser p, JavaType valueType)

Actual implementation of value reading+binding operation.

protected SerializationContextExt
_serializationContext(SerializationConfig config)

Overridable helper method used for constructing SerializationContext to use for serialization.

public SerializationContextExt
protected final void
protected void
protected final void
_writeCloseableValue(JsonGenerator g, Object value, SerializationConfig cfg)

Helper method used when value to serialize is Closeable and its close() method is to be called right after serialization has been called

public void
acceptJsonFormatVisitor(Class<?>
Type to generate schema for (possibly with generic signature)
type
,
JsonFormatVisitorWrapper visitor)

Method for visiting type hierarchy for given type, using specified visitor.

public void
public void
acceptJsonFormatVisitor(JavaType
Type to generate schema for (possibly with generic signature)
type
,
JsonFormatVisitorWrapper visitor)

Method for visiting type hierarchy for given type, using specified visitor.

public JsonNode
public void
clearCaches()

Method that will clear all caches this mapper owns.

public JavaType
constructType(Type type)

Convenience method for constructing JavaType out of given type (typically java.lang.Class), but without explicit context.

public JavaType
constructType(TypeReference<?> typeReference)

Convenience method for constructing JavaType out of given type reference.

public <T> T
convertValue(Object fromValue, Class<T> toValueType)

Convenience method for doing two-step conversion from given value, into instance of given value type, by writing value into temporary buffer and reading from the buffer into specified target type.

public <T> T
public <T> T
public ArrayNode
createArrayNode()

Implements tools.jackson.core.TreeCodec.createArrayNode.

Note

return type is co-variant, as basic TreeCodec abstraction cannot refer to concrete node types (as it's part of core package, whereas impls are part of mapper package)

public JsonGenerator
createGenerator(OutputStream out)

Factory method for constructing JsonGenerator that is properly wired to allow callbacks for serialization: basically constructs a ObjectWriteContext and then calls TokenStreamFactory#createGenerator(ObjectWriteContext, OutputStream).

public JsonGenerator
createGenerator(OutputStream out, JsonEncoding enc)

Factory method for constructing JsonGenerator that is properly wired to allow callbacks for serialization: basically constructs a ObjectWriteContext and then calls TokenStreamFactory#createGenerator(ObjectWriteContext, OutputStream, JsonEncoding).

public JsonGenerator
createGenerator(Writer w)

Factory method for constructing JsonGenerator that is properly wired to allow callbacks for serialization: basically constructs a ObjectWriteContext and then calls TokenStreamFactory#createGenerator(ObjectWriteContext, Writer).

public JsonGenerator
createGenerator(File f, JsonEncoding enc)

Factory method for constructing JsonGenerator that is properly wired to allow callbacks for serialization: basically constructs a ObjectWriteContext and then calls TokenStreamFactory#createGenerator(ObjectWriteContext, File, JsonEncoding).

public JsonGenerator
createGenerator(Path path, JsonEncoding enc)

Factory method for constructing JsonGenerator that is properly wired to allow callbacks for serialization: basically constructs a ObjectWriteContext and then calls TokenStreamFactory#createGenerator(ObjectWriteContext, Path, JsonEncoding).

public JsonGenerator
createGenerator(DataOutput out)

Factory method for constructing JsonGenerator that is properly wired to allow callbacks for serialization: basically constructs a ObjectWriteContext and then calls TokenStreamFactory#createGenerator(ObjectWriteContext, DataOutput).

public JsonParser
createNonBlockingByteArrayParser()

Factory method for constructing non-blocking JsonParser that is properly wired to allow configuration access (and, if relevant for parser, callbacks): essentially constructs a ObjectReadContext and then calls TokenStreamFactory#createNonBlockingByteArrayParser(ObjectReadContext).

public JsonParser
createNonBlockingByteBufferParser()

Factory method for constructing non-blocking JsonParser that is properly wired to allow configuration access (and, if relevant for parser, callbacks): essentially constructs a ObjectReadContext and then calls TokenStreamFactory#createNonBlockingByteBufferParser(ObjectReadContext).

public ObjectNode
createObjectNode()

Implements tools.jackson.core.TreeCodec.createObjectNode.

Note

return type is co-variant, as basic TreeCodec abstraction cannot refer to concrete node types (as it's part of core package, whereas impls are part of mapper package)

public JsonParser
createParser(File src)

Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory#createParser(ObjectReadContext, java.io.File).

public JsonParser
createParser(Path src)

Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory#createParser(ObjectReadContext, Path).

public JsonParser
createParser(InputStream in)

Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory#createParser(ObjectReadContext, InputStream).

public JsonParser
createParser(Reader r)

Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory#createParser(ObjectReadContext, Reader).

public JsonParser
createParser(byte[] content)

Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory#createParser(ObjectReadContext, byte[]).

public JsonParser
createParser(byte[] content, int offset, int len)

Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory#createParser(ObjectReadContext, byte[], int, int).

public JsonParser
createParser(String content)

Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory#createParser(ObjectReadContext, String).

public JsonParser
createParser(char[] content)

Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory#createParser(ObjectReadContext, char[]).

public JsonParser
createParser(char[] content, int offset, int len)

Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory#createParser(ObjectReadContext, char[], int, int).

public JsonParser
createParser(DataInput content)

Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory#createParser(ObjectReadContext, DataInput).

public DeserializationConfig
deserializationConfig()

Accessor for internal configuration object that contains settings for deserialization operations (readValue(...) methods)

Note

Not to be used by application code; needed by some tests

public InjectableValues
public JsonNodeFactory
getNodeFactory()

Method that can be used to get hold of JsonNodeFactory that this mapper will use when directly constructing root JsonNode instances for Trees.

public TypeFactory
getTypeFactory()

Accessor for getting currently configured TypeFactory instance.

public boolean
public boolean
public boolean
public boolean
isEnabled(MapperFeature f)

Method for checking whether given MapperFeature is enabled.

public boolean
isEnabled(DeserializationFeature f)

Method for checking whether given deserialization-specific feature is enabled.

public boolean
isEnabled(SerializationFeature f)

Method for checking whether given serialization-specific feature is enabled.

public boolean
isEnabled(DatatypeFeature f)

Method for checking whether given datatype-specific feature is enabled.

public JsonNode
public JsonNode
public ObjectReader
reader()

Factory method for constructing ObjectReader with default settings.

public ObjectReader
reader(DeserializationFeature feature)

Factory method for constructing ObjectReader with specified feature enabled (compared to settings that this mapper instance has).

public ObjectReader
reader(DeserializationFeature first, DeserializationFeature... other)

Factory method for constructing ObjectReader with specified features enabled (compared to settings that this mapper instance has).

public ObjectReader
reader(DatatypeFeature feature)

Factory method for constructing ObjectReader with specified feature enabled (compared to settings that this mapper instance has).

public ObjectReader
reader(JsonNodeFactory nodeFactory)

Factory method for constructing ObjectReader that will use specified JsonNodeFactory for constructing JSON trees.

public ObjectReader
reader(FormatSchema
Schema to pass to parser
schema
)

Factory method for constructing ObjectReader that will pass specific schema object to JsonParser used for reading content.

public ObjectReader
reader(InjectableValues
Injectable values to use
injectableValues
)

Factory method for constructing ObjectReader that will use specified injectable values.

public ObjectReader
reader(Base64Variant defaultBase64)

Factory method for constructing ObjectReader that will use specified Base64 encoding variant for Base64-encoded binary data.

public ObjectReader
reader(ContextAttributes attrs)

Factory method for constructing ObjectReader that will use specified default attributes.

public ObjectReader
readerFor(JavaType type)

Factory method for constructing ObjectReader that will read or update instances of specified type

public ObjectReader
readerFor(Class<?> type)

Factory method for constructing ObjectReader that will read or update instances of specified type

public ObjectReader
readerFor(TypeReference<?> typeRef)

Factory method for constructing ObjectReader that will read or update instances of specified type

public ObjectReader
readerForArrayOf(Class<?> type)

Factory method for constructing ObjectReader that will read values of a type List<type>.

public ObjectReader
readerForListOf(Class<?> type)

Factory method for constructing ObjectReader that will read or update instances of a type List<type>.

public ObjectReader
readerForMapOf(Class<?> type)

Factory method for constructing ObjectReader that will read or update instances of a type Map<String, type> Functionally same as:

    readerFor(new TypeReference<Map<String, type>>() { });
public ObjectReader
readerForUpdating(Object valueToUpdate)

Factory method for constructing ObjectReader that will update given Object (usually Bean, but can be a Collection or Map as well, but NOT an array) with JSON data.

public ObjectReader
readerWithView(Class<?> view)

Factory method for constructing ObjectReader that will deserialize objects using specified JSON View (filter).

protected Object
public JsonNode

Returns:

a JsonNode, if valid JSON content found; null if input has no content to bind -- note, however, that if JSON null token is found, it will be represented as a non-null JsonNode (one that returns true for JsonNode#isNull()
readTree
(JsonParser p)

Implements tools.jackson.core.TreeCodec.readTree.

Method to deserialize JSON content as a tree JsonNode.

public JsonNode

Returns:

a JsonNode, if valid JSON content found; null if input has no content to bind -- note, however, that if JSON null token is found, it will be represented as a non-null JsonNode (one that returns true for JsonNode#isNull()
readTree
(InputStream
Input stream used to read JSON content for building the JSON tree.
in
)

Method to deserialize JSON content as tree expressed using set of JsonNode instances.

public JsonNode
readTree(Reader r)

Same as readTree(InputStream) except content accessed through passed-in Reader

public JsonNode
readTree(String content)

Same as readTree(InputStream) except content read from passed-in String

public JsonNode
readTree(byte[] content)

Same as readTree(InputStream) except content read from passed-in byte array.

public JsonNode
readTree(byte[] content, int offset, int len)

Same as readTree(InputStream) except content read from passed-in byte array.

public JsonNode
readTree(File file)

Same as readTree(InputStream) except content read from passed-in File.

public JsonNode
readTree(Path path)

Same as readTree(InputStream) except content read from passed-in Path.

public JsonNode
readTree(TokenBuffer src)

Same as readTree(InputStream) except content read from passed-in TokenBuffer.

public <T> T
readValue(JsonParser p, Class<T> valueType)

Method to deserialize JSON content into a non-container type (it can be an array type, however): typically a bean, array or a wrapper type (like java.lang.Boolean).

public <T> T
readValue(JsonParser p, TypeReference<T> valueTypeRef)

Method to deserialize JSON content into a Java type, reference to which is passed as argument.

public final <T> T
readValue(JsonParser p, ResolvedType valueType)

Method to deserialize JSON content into a Java type, reference to which is passed as argument.

public <T> T
readValue(JsonParser p, JavaType valueType)

Type-safe overloaded method, basically alias for readValue(JsonParser, Class).

public <T> T
readValue(File src, Class<T> valueType)

Method to deserialize JSON content from given file into given Java type.

public <T> T
readValue(File src, TypeReference<T> valueTypeRef)

Method to deserialize JSON content from given file into given Java type.

public <T> T
readValue(File src, JavaType valueType)

Method to deserialize JSON content from given file into given Java type.

public <T> T
readValue(Path src, Class<T> valueType)

Method to deserialize JSON content from given path into given Java type.

public <T> T
readValue(Path src, TypeReference<T> valueTypeRef)

Method to deserialize JSON content from given path into given Java type.

public <T> T
readValue(Path src, JavaType valueType)

Method to deserialize JSON content from given path into given Java type.

public <T> T
readValue(String content, Class<T> valueType)

Method to deserialize JSON content from given JSON content String.

public <T> T
readValue(String content, TypeReference<T> valueTypeRef)

Method to deserialize JSON content from given JSON content String.

public <T> T
readValue(String content, JavaType valueType)

Method to deserialize JSON content from given JSON content String.

public <T> T
readValue(Reader src, Class<T> valueType)

public <T> T
readValue(Reader src, TypeReference<T> valueTypeRef)

public <T> T
readValue(Reader src, JavaType valueType)

public <T> T
readValue(InputStream src, Class<T> valueType)

public <T> T
readValue(InputStream src, TypeReference<T> valueTypeRef)

public <T> T
readValue(InputStream src, JavaType valueType)

public <T> T
readValue(byte[] content, Class<T> valueType)

public <T> T
readValue(byte[] content, int offset, int len, Class<T> valueType)

public <T> T
readValue(byte[] content, TypeReference<T> valueTypeRef)

public <T> T
readValue(byte[] content, int offset, int len, TypeReference<T> valueTypeRef)

public <T> T
readValue(byte[] content, JavaType valueType)

public <T> T
readValue(byte[] content, int offset, int len, JavaType valueType)

public <T> T
readValue(DataInput src, Class<T> valueType)

public <T> T
readValue(DataInput src, JavaType valueType)

public <T> T
readValue(DataInput src, TypeReference<T> valueTypeRef)

public <T> T
readValue(TokenBuffer src, Class<T> valueType)

public <T> T
readValue(TokenBuffer src, JavaType valueType)

public <T> T
readValue(TokenBuffer src, TypeReference<T> valueTypeRef)

public <T> MappingIterator<T>
readValues(JsonParser p, JavaType valueType)

Convenience method, equivalent in function to:

   readerFor(valueType).readValues(p);
public <T> MappingIterator<T>
readValues(JsonParser p, Class<T> valueType)

Convenience method, equivalent in function to:

   readerFor(valueType).readValues(p);
public <T> MappingIterator<T>
public <M extends ObjectMapper, B extends MapperBuilder<M, B>> MapperBuilder<M, B>
rebuild()

Method for creating a new MapperBuilder for constructing differently configured ObjectMapper instance, starting with current configuration including base settings and registered modules.

public Collection<JacksonModule>
registeredModules()

Method that may be used to find out JacksonModules that were registered when creating this mapper (if any).

public SerializationConfig
serializationConfig()

Accessor for internal configuration object that contains settings for serialization operations (writeValue(...) methods)

Note

Not to be used by application code; needed by some tests

public JsonNode
public TokenStreamFactory

Returns:

TokenStreamFactory that this mapper uses when it needs to construct Json parser and generators
tokenStreamFactory
()

Method that can be used to get hold of TokenStreamFactory that this mapper uses if it needs to construct JsonParsers and/or JsonGenerators.

public JsonParser
treeAsTokens(TreeNode
Root node of the tree that resulting parser will read from
n
)

Implements tools.jackson.core.TreeCodec.treeAsTokens.

Method for constructing a JsonParser out of JSON tree representation.

public <T> T
treeToValue(TreeNode n, Class<T> valueType)

Convenience conversion method that will bind data given JSON tree contains into specific value (usually bean) type.

public <T> T
treeToValue(TreeNode n, JavaType valueType)

Same as treeToValue(TreeNode, Class) but target type specified using fully resolved JavaType.

public <T> T
treeToValue(TreeNode n, TypeReference<T> toValueTypeRef)

Same as treeToValue(TreeNode, JavaType) but target type specified using fully resolved TypeReference.

public <T> T

Returns:

Either the first argument (`valueToUpdate`), if it is mutable; or a result of creating new instance that is result of "merging" values (for example, "updating" a Java array will create a new array)
updateValue
(T
Object to update
valueToUpdate
,
Object
Object to conceptually serialize and merge into value to update; can be thought of as a provider for overrides to apply.
overrides
)

Convenience method similar to convertValue(Object, JavaType) but one in which

Implementation is approximately as follows:

  1. Serialize `updateWithValue` into TokenBuffer
  2. Construct ObjectReader with `valueToUpdate` (using readerForUpdating(Object))
  3. Construct JsonParser (using TokenBuffer#asParser(ObjectReadContext))
  4. Update using ObjectReader#readValue(JsonParser).
  5. Return `valueToUpdate`
public <
Actual node type; usually either basic JsonNode or tools.jackson.databind.node.ObjectNode
T extends JsonNode
>
T

Returns:

(non-null) Root node of the resulting content tree: in case of null value node for which JsonNode#isNull() returns true.
valueToTree
(Object
Java value to convert
fromValue
)

Method that is reverse of treeToValue: it will convert given Java value (usually bean) into its equivalent Tree model JsonNode representation.

public Version
version()

Implements tools.jackson.core.Versioned.version.

Method that will return version information stored in and read from jar that contains this class.

public ObjectWriter
writer()

Convenience method for constructing ObjectWriter with default settings.

public ObjectWriter
writer(SerializationFeature feature)

Factory method for constructing ObjectWriter with specified feature enabled (compared to settings that this mapper instance has).

public ObjectWriter
writer(SerializationFeature first, SerializationFeature... other)

Factory method for constructing ObjectWriter with specified features enabled (compared to settings that this mapper instance has).

public ObjectWriter
writer(DatatypeFeature f)

Factory method for constructing ObjectWriter with specified features enabled (compared to settings that this mapper instance has).

public ObjectWriter
writer(DateFormat df)

Factory method for constructing ObjectWriter that will serialize objects using specified DateFormat; or, if null passed, using timestamp (64-bit number.

public ObjectWriter
writer(FilterProvider filterProvider)

Factory method for constructing ObjectWriter that will serialize objects using specified filter provider.

public ObjectWriter
writer(FormatSchema
Schema to pass to generator
schema
)

Factory method for constructing ObjectWriter that will pass specific schema object to JsonGenerator used for writing content.

public ObjectWriter
writer(Base64Variant defaultBase64)

Factory method for constructing ObjectWriter that will use specified Base64 encoding variant for Base64-encoded binary data.

public ObjectWriter
writer(CharacterEscapes escapes)

Factory method for constructing ObjectReader that will use specified character escaping details for output.

public ObjectWriter
writer(ContextAttributes attrs)

Factory method for constructing ObjectWriter that will use specified default attributes.

protected Object
public ObjectWriter
writerFor(Class<?> rootType)

Factory method for constructing ObjectWriter that will serialize objects using specified root type, instead of actual runtime type of value.

public ObjectWriter
writerFor(TypeReference<?> rootType)

Factory method for constructing ObjectWriter that will serialize objects using specified root type, instead of actual runtime type of value.

public ObjectWriter
writerFor(JavaType rootType)

Factory method for constructing ObjectWriter that will serialize objects using specified root type, instead of actual runtime type of value.

public ObjectWriter
writerWithDefaultPrettyPrinter()

Factory method for constructing ObjectWriter that will serialize objects using the default pretty printer for indentation

public ObjectWriter
writerWithView(Class<?> serializationView)

Factory method for constructing ObjectWriter that will serialize objects using specified JSON View (filter).

public void
public void
writeValue(JsonGenerator g, Object value)

Method that can be used to serialize any Java value as JSON output, using provided JsonGenerator.

public void
writeValue(File file, Object value)

Method that can be used to serialize any Java value as JSON output, written to File provided.

public void
writeValue(Path path, Object value)

Method that can be used to serialize any Java value as JSON output, written to Path provided.

public void
writeValue(OutputStream out, Object value)

Method that can be used to serialize any Java value as JSON output, using output stream provided (using encoding JsonEncoding#UTF8).

public void
public void
writeValue(Writer w, Object value)

Method that can be used to serialize any Java value as JSON output, using Writer provided.

public byte[]
writeValueAsBytes(Object value)

Method that can be used to serialize any Java value as a byte array.

public String
writeValueAsString(Object value)

Method that can be used to serialize any Java value as a String.

public TokenBuffer
writeValueIntoBuffer(Object value)

Convenience method that can be used to serialize any Java value into newly created TokenBuffer.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait