Java com.fasterxml.jackson.databind ObjectMapper fields, constructors, methods, implement or subclass

Example usage for Java com.fasterxml.jackson.databind ObjectMapper fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for com.fasterxml.jackson.databind ObjectMapper.

The text is from its open source code.

Subclass

com.fasterxml.jackson.databind.ObjectMapper has subclasses.
Click this link to see all its subclasses.

Constructor

ObjectMapper()
Default constructor, which will construct the default JsonFactory as necessary, use SerializerProvider as its SerializerProvider , and BeanSerializerFactory as its SerializerFactory .
ObjectMapper(JsonFactory jf)
Constructs instance that uses specified JsonFactory for constructing necessary JsonParser s and/or JsonGenerator s.
ObjectMapper(ObjectMapper src)
Copy-constructor, mostly used to support #copy .

Method

voidacceptJsonFormatVisitor(Class type, JsonFormatVisitorWrapper visitor)
Method for visiting type hierarchy for given type, using specified visitor.
voidacceptJsonFormatVisitor(JavaType type, JsonFormatVisitorWrapper visitor)
Method for visiting type hierarchy for given type, using specified visitor.
ObjectMapperaddHandler(DeserializationProblemHandler h)
Method for adding specified DeserializationProblemHandler to be used for handling specific problems during deserialization.
voidaddMixInAnnotations(Class target, Class mixinSource)
Method to use for adding mix-in annotations to use for augmenting specified class or interface.
booleancanDeserialize(JavaType type)
Method that can be called to check whether mapper thinks it could deserialize an Object of given type.
booleancanSerialize(Class type)
Method that can be called to check whether mapper thinks it could serialize an instance of given Class.
ObjectMapperconfigure(MapperFeature f, boolean state)
Method for changing state of an on/off mapper feature for this mapper instance.
ObjectMapperconfigure(SerializationFeature f, boolean state)
Method for changing state of an on/off serialization feature for this object mapper.
ObjectMapperconfigure(DeserializationFeature f, boolean state)
Method for changing state of an on/off deserialization feature for this object mapper.
ObjectMapperconfigure(JsonParser.Feature f, boolean state)
Method for changing state of an on/off JsonParser feature for JsonFactory instance this object mapper uses.
ObjectMapperconfigure(JsonGenerator.Feature f, boolean state)
Method for changing state of an on/off JsonGenerator feature for JsonFactory instance this object mapper uses.
JavaTypeconstructType(Type t)
Convenience method for constructing JavaType out of given type (typically java.lang.Class), but without explicit context.
TconvertValue(Object fromValue, Class toValueType)
Convenience method for doing two-step conversion from given value, into instance of given value type.
TconvertValue(Object fromValue, TypeReference toValueTypeRef)
TconvertValue(Object fromValue, JavaType toValueType)
ObjectMappercopy()
Method for creating a new ObjectMapper instance that has same initial configuration as this instance.
ArrayNodecreateArrayNode()

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

ObjectNodecreateObjectNode()

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

ObjectMapperdisable(MapperFeature... f)
Method for enabling specified DeserializationConfig features.
ObjectMapperdisable(DeserializationFeature feature)
Method for enabling specified DeserializationConfig features.
ObjectMapperdisable(SerializationFeature f)
Method for enabling specified DeserializationConfig features.
ObjectMapperdisable(DeserializationFeature first, DeserializationFeature... f)
Method for enabling specified DeserializationConfig features.
ObjectMapperdisable(SerializationFeature first, SerializationFeature... f)
Method for enabling specified DeserializationConfig features.
ObjectMapperenable(MapperFeature... f)
Method for enabling specified MapperConfig features.
ObjectMapperenable(DeserializationFeature feature)
Method for enabling specified DeserializationConfig features.
ObjectMapperenable(SerializationFeature f)
Method for enabling specified DeserializationConfig feature.
ObjectMapperenable(DeserializationFeature first, DeserializationFeature... f)
Method for enabling specified DeserializationConfig features.
ObjectMapperenable(SerializationFeature first, SerializationFeature... f)
Method for enabling specified DeserializationConfig features.
ObjectMapperenableDefaultTyping(DefaultTyping dti)
Convenience method that is equivalent to calling
 enableObjectTyping(dti, JsonTypeInfo.As.WRAPPER_ARRAY); 
ObjectMapperenableDefaultTyping()
Convenience method that is equivalent to calling
 enableObjectTyping(DefaultTyping.OBJECT_AND_NON_CONCRETE); 
ObjectMapperenableDefaultTyping(DefaultTyping applicability, JsonTypeInfo.As includeAs)
Method for enabling automatic inclusion of type information, needed for proper deserialization of polymorphic types (unless types have been annotated with com.fasterxml.jackson.annotation.JsonTypeInfo ).
ObjectMapperenableDefaultTypingAsProperty(DefaultTyping applicability, String propertyName)
Method for enabling automatic inclusion of type information -- needed for proper deserialization of polymorphic types (unless types have been annotated with com.fasterxml.jackson.annotation.JsonTypeInfo ) -- using "As.PROPERTY" inclusion mechanism and specified property name to use for inclusion (default being "@class" since default type information always uses class name as type identifier)
ObjectMapperfindAndRegisterModules()
Convenience method that is functionally equivalent to: mapper.registerModules(mapper.findModules());

As with #findModules() , no caching is done for modules, so care needs to be taken to either create and share a single mapper instance; or to cache introspected set of modules.

ClassfindMixInClassFor(Class cls)
ListfindModules(ClassLoader classLoader)
Method for locating available methods, using JDK ServiceLoader facility, along with module-provided SPI.
ListfindModules()
Method for locating available methods, using JDK ServiceLoader facility, along with module-provided SPI.
com.fasterxml.jackson.databind.jsonschema.JsonSchemagenerateJsonSchema(Class t)
Generate Json-schema instance for specified class.
ClassgetClass()
Returns the runtime class of this Object .
DeserializationConfiggetDeserializationConfig()
Method that returns the shared default DeserializationConfig object that defines configuration settings for deserialization.
DeserializationContextgetDeserializationContext()
Method for getting current DeserializationContext .
JsonFactorygetFactory()
Method that can be used to get hold of JsonFactory that this mapper uses if it needs to construct JsonParser s and/or JsonGenerator s.
JsonFactorygetJsonFactory()
JsonNodeFactorygetNodeFactory()
Method that can be used to get hold of JsonNodeFactory that this mapper will use when directly constructing root JsonNode instances for Trees.
SerializationConfiggetSerializationConfig()
Method that returns the shared default SerializationConfig object that defines configuration settings for serialization.
SerializerFactorygetSerializerFactory()
Method for getting current SerializerFactory .
SerializerProvidergetSerializerProvider()
SubtypeResolvergetSubtypeResolver()
Method for accessing subtype resolver in use.
TypeFactorygetTypeFactory()
Accessor for getting currently configured TypeFactory instance.
VisibilityCheckergetVisibilityChecker()
Method for accessing currently configured visibility checker; object used for determining whether given property element (method, field, constructor) can be auto-detected or not.
ObjectReaderreader()
Factory method for constructing ObjectReader with default settings.
ObjectReaderreader(DeserializationFeature feature)
Factory method for constructing ObjectReader with specified feature enabled (compared to settings that this mapper instance has).
ObjectReaderreader(JavaType type)
Factory method for constructing ObjectReader that will read or update instances of specified type
ObjectReaderreader(Class type)
Factory method for constructing ObjectReader that will read or update instances of specified type
ObjectReaderreader(TypeReference type)
Factory method for constructing ObjectReader that will read or update instances of specified type
ObjectReaderreader(JsonNodeFactory f)
Factory method for constructing ObjectReader that will use specified JsonNodeFactory for constructing JSON trees.
ObjectReaderreader(FormatSchema schema)
Factory method for constructing ObjectReader that will pass specific schema object to JsonParser used for reading content.
ObjectReaderreader(InjectableValues injectableValues)
Factory method for constructing ObjectReader that will use specified injectable values.
ObjectReaderreader(Base64Variant defaultBase64)
Factory method for constructing ObjectReader that will use specified Base64 encoding variant for Base64-encoded binary data.
ObjectReaderreader(ContextAttributes attrs)
Factory method for constructing ObjectReader that will use specified default attributes.
ObjectReaderreaderForUpdating(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.
TreadTree(JsonParser jp)
Method to deserialize JSON content as tree expressed using set of JsonNode instances.
JsonNodereadTree(InputStream in)
Method to deserialize JSON content as tree expressed using set of JsonNode instances.
JsonNodereadTree(Reader r)
Method to deserialize JSON content as tree expressed using set of JsonNode instances.
JsonNodereadTree(String content)
Method to deserialize JSON content as tree expressed using set of JsonNode instances.
JsonNodereadTree(byte[] content)
Method to deserialize JSON content as tree expressed using set of JsonNode instances.
JsonNodereadTree(File file)
Method to deserialize JSON content as tree expressed using set of JsonNode instances.
JsonNodereadTree(URL source)
Method to deserialize JSON content as tree expressed using set of JsonNode instances.
TreadValue(JsonParser jp, Class 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 ).
TreadValue(JsonParser jp, TypeReference valueTypeRef)
Method to deserialize JSON content into a Java type, reference to which is passed as argument.
TreadValue(JsonParser jp, ResolvedType valueType)
Method to deserialize JSON content into a Java type, reference to which is passed as argument.
TreadValue(JsonParser jp, JavaType valueType)
Type-safe overloaded method, basically alias for #readValue(JsonParser,ResolvedType) .
TreadValue(File src, Class valueType)
TreadValue(File src, TypeReference valueTypeRef)
TreadValue(File src, JavaType valueType)
TreadValue(URL src, Class valueType)
TreadValue(URL src, TypeReference valueTypeRef)
TreadValue(URL src, JavaType valueType)
TreadValue(String content, Class valueType)
TreadValue(String content, TypeReference valueTypeRef)
TreadValue(String content, JavaType valueType)
TreadValue(Reader src, Class valueType)
TreadValue(Reader src, TypeReference valueTypeRef)
TreadValue(Reader src, JavaType valueType)
TreadValue(InputStream src, Class valueType)
TreadValue(InputStream src, TypeReference valueTypeRef)
TreadValue(InputStream src, JavaType valueType)
TreadValue(byte[] src, Class valueType)
TreadValue(byte[] src, TypeReference valueTypeRef)
TreadValue(byte[] src, JavaType valueType)
MappingIteratorreadValues(JsonParser jp, ResolvedType valueType)
Method for reading sequence of Objects from parser stream.
MappingIteratorreadValues(JsonParser jp, JavaType valueType)
Type-safe overloaded method, basically alias for #readValues(JsonParser,ResolvedType) .
MappingIteratorreadValues(JsonParser jp, Class valueType)
Type-safe overloaded method, basically alias for #readValues(JsonParser,ResolvedType) .
MappingIteratorreadValues(JsonParser jp, TypeReference valueTypeRef)
Method for reading sequence of Objects from parser stream.
ObjectMapperregisterModule(Module module)
Method for registering a module that can extend functionality provided by this mapper; for example, by adding providers for custom serializers and deserializers.
ObjectMapperregisterModules(Module... modules)
Convenience method for registering specified modules in order; functionally equivalent to:
 for (Module module : modules) { registerModule(module); } 
ObjectMapperregisterModules(Iterable modules)
Convenience method for registering specified modules in order; functionally equivalent to:
 for (Module module : modules) { registerModule(module); } 
voidregisterSubtypes(Class... classes)
Method for registering specified class as a subtype, so that typename-based resolution can link supertypes to subtypes (as an alternative to using annotations).
voidregisterSubtypes(NamedType... types)
Method for registering specified class as a subtype, so that typename-based resolution can link supertypes to subtypes (as an alternative to using annotations).
ObjectMappersetAnnotationIntrospector(AnnotationIntrospector ai)
Method for changing AnnotationIntrospector used by this mapper instance for both serialization and deserialization
ObjectMappersetAnnotationIntrospectors(AnnotationIntrospector serializerAI, AnnotationIntrospector deserializerAI)
Method for changing AnnotationIntrospector instances used by this mapper instance for serialization and deserialization, specifying them separately so that different introspection can be used for different aspects
ObjectMappersetConfig(DeserializationConfig config)
Method that allows overriding of the underlying DeserializationConfig object.
ObjectMappersetConfig(SerializationConfig config)
Method that allows overriding of the underlying SerializationConfig object, which contains serialization-specific configuration settings.
ObjectMappersetDateFormat(DateFormat dateFormat)
Method for configuring the default DateFormat to use when serializing time values as Strings, and deserializing from JSON Strings.
ObjectMappersetDefaultTyping(TypeResolverBuilder typer)
Method for enabling automatic inclusion of type information, using specified handler object for determining which types this affects, as well as details of how information is embedded.
voidsetFilters(FilterProvider filterProvider)
Convenience method that is equivalent to:
 mapper.setFilters(mapper.getSerializationConfig().withFilters(filterProvider)); 

Note that usually it is better to use method #writer(FilterProvider) ; however, sometimes this method is more convenient.

ObjectsetHandlerInstantiator(HandlerInstantiator hi)
Method for configuring HandlerInstantiator to use for creating instances of handlers (such as serializers, deserializers, type and type id resolvers), given a class.
ObjectMappersetInjectableValues(InjectableValues injectableValues)
Method for configuring InjectableValues which used to find values to inject.
ObjectMappersetLocale(Locale l)
Method for overriding default locale to use for formatting.
ObjectMappersetNodeFactory(JsonNodeFactory f)
Method for specifying JsonNodeFactory to use for constructing root level tree nodes (via method #createObjectNode
ObjectMappersetPropertyNamingStrategy(PropertyNamingStrategy s)
Method for setting custom property naming strategy to use.
ObjectMappersetSerializationInclusion(JsonInclude.Include incl)
Method for setting defalt POJO property inclusion strategy for serialization.
ObjectMappersetSerializerFactory(SerializerFactory f)
Method for setting specific SerializerFactory to use for constructing (bean) serializers.
ObjectMappersetSerializerProvider(DefaultSerializerProvider p)
Method for setting specific SerializerProvider to use for handling caching of JsonSerializer instances.
ObjectMappersetSubtypeResolver(SubtypeResolver str)
Method for setting custom subtype resolver to use.
ObjectMappersetTimeZone(TimeZone tz)
Method for overriding default TimeZone to use for formatting.
ObjectMappersetVisibility(PropertyAccessor forMethod, JsonAutoDetect.Visibility visibility)
Convenience method that allows changing configuration for underlying VisibilityChecker s, to change details of what kinds of properties are auto-detected.
voidsetVisibilityChecker(VisibilityChecker vc)
Method for setting currently configured visibility checker; object used for determining whether given property element (method, field, constructor) can be auto-detected or not.
StringtoString()
Returns a string representation of the object.
JsonParsertreeAsTokens(TreeNode n)
Method for constructing a JsonParser out of JSON tree representation.
TtreeToValue(TreeNode n, Class valueType)
Convenience conversion method that will bind data given JSON tree contains into specific value (usually bean) type.
TvalueToTree(Object fromValue)
Reverse of #treeToValue ; given a value (usually bean), will construct equivalent JSON Tree representation.
Versionversion()
Method that will return version information stored in and read from jar that contains this class.
ObjectWriterwriter()
Convenience method for constructing ObjectWriter with default settings.
ObjectWriterwriter(SerializationFeature feature)
Factory method for constructing ObjectWriter with specified feature enabled (compared to settings that this mapper instance has).
ObjectWriterwriter(DateFormat df)
Factory method for constructing ObjectWriter that will serialize objects using specified DateFormat ; or, if null passed, using timestamp (64-bit number.
ObjectWriterwriter(PrettyPrinter pp)
Factory method for constructing ObjectWriter that will serialize objects using specified pretty printer for indentation (or if null, no pretty printer)
ObjectWriterwriter(FilterProvider filterProvider)
Factory method for constructing ObjectWriter that will serialize objects using specified filter provider.
ObjectWriterwriter(FormatSchema schema)
Factory method for constructing ObjectWriter that will pass specific schema object to JsonGenerator used for writing content.
ObjectWriterwriter(Base64Variant defaultBase64)
Factory method for constructing ObjectWriter that will use specified Base64 encoding variant for Base64-encoded binary data.
ObjectWriterwriter(CharacterEscapes escapes)
Factory method for constructing ObjectReader that will use specified character escaping details for output.
ObjectWriterwriter(ContextAttributes attrs)
Factory method for constructing ObjectWriter that will use specified default attributes.
ObjectWriterwriterWithDefaultPrettyPrinter()
Factory method for constructing ObjectWriter that will serialize objects using the default pretty printer for indentation
ObjectWriterwriterWithType(Class rootType)
Factory method for constructing ObjectWriter that will serialize objects using specified root type, instead of actual runtime type of value.
ObjectWriterwriterWithType(TypeReference rootType)
Factory method for constructing ObjectWriter that will serialize objects using specified root type, instead of actual runtime type of value.
ObjectWriterwriterWithType(JavaType rootType)
Factory method for constructing ObjectWriter that will serialize objects using specified root type, instead of actual runtime type of value.
ObjectWriterwriterWithView(Class serializationView)
Factory method for constructing ObjectWriter that will serialize objects using specified JSON View (filter).
voidwriteTree(JsonGenerator jgen, TreeNode rootNode)
voidwriteTree(JsonGenerator jgen, JsonNode rootNode)
Method to serialize given JSON Tree, using generator provided.
voidwriteValue(JsonGenerator jgen, Object value)
Method that can be used to serialize any Java value as JSON output, using provided JsonGenerator .
voidwriteValue(File resultFile, Object value)
Method that can be used to serialize any Java value as JSON output, written to File provided.
voidwriteValue(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 ).
voidwriteValue(Writer w, Object value)
Method that can be used to serialize any Java value as JSON output, using Writer provided.
byte[]writeValueAsBytes(Object value)
Method that can be used to serialize any Java value as a byte array.
StringwriteValueAsString(Object value)
Method that can be used to serialize any Java value as a String.