Skip to content
Tatu Saloranta edited this page Dec 4, 2016 · 23 revisions

Jackson: the Missing Reference Manual

1. Intro

(Welcome to the Jungle)

This document (book, wiki page) tries to be the manual you always needed to learn how to make effective use of the tool set known as Jackson Data Processor (*). Due to sheer size of the tool set and problem space it can be used on, manual will fall on wide-but-not-super-deep category: this is by design. I try to cover things in enough depth to get you started; and will try not to over-simplify concepts, but at some point it may be necessary dig in alternative documentation -- this is not The Exhaustive and Detailed Reference Manual.

(*) nee "Jackson JSON parser"

Jackson has been in active development since early 2007. This chapter covers the history briefly, and explains some of the insights gained as well as ideology behind the development efforts.

Many JSON libraries offer just a single method of processing JSON content, but there are 3 canonical processing models. Jackson supports all these models, and they can be used independently but also integrate nicely so that you can mix and match processing models to suit your needs.

This chapter explains major models and how Jackson supports them:

We already briefly use Jackson API in the Introduction, to perform common JSON processing tasks: reading and writing JSON, as well as doing some simple conversions. This chapter goes over main structure of API and overviews main entities you will work with.

4.1 Databinding: ObjectMapper and Friends

  • PropertyNamingStrategy?

ObjectReader (and related)

  • MappingIterator

ObjectWriter (and related)

  • SequenceWriter

[JavaType](Chapter-API-Databind-JavaType] (and related)

  • TypeFactory
  • TypeReference

4.2 Streaming API: JsonFactory and Friends

4.3 TreeModel: JsonNode and Friends

4.4 Databinding: Context objects

Access to current type, parent context, current mapped value

Barebones interface for callbacks to ObjectMapper, -Reader and -Writer

4.5 Misc other

  • TokenBuffer for efficient buffering, used internally for buffering, conversions

5. Annotation-based Configuration

Mostly for databinding.

5.x Alternative AnnotationIntrospectors

5.x Mix-in annotations

6. Configuration: on/off Features

6.1 Data-binding features

6.1.1 MapperFeature

6.1.2 DeserializationFeature

6.1.3 SerializationFeature

6.2 Streaming features

6.2.1 JsonFactory.Feature

6.2.2 JsonParser.Feature

6.2.3 JsonGenerator.Feature

6.2.4 FormatFeature

7. Configuration: Other

7.1 ObjectMapper configuration

7.2 ObjectReader configuration

7.3 ObjectWriter configuration

7.4 Configuration by Module

7.5 FormatSchema

  • Forward ref to data formats

8. Advanced Features

8.1 Polymorphic type handling

  • Annotations (@JsonTypeInfo)
  • Default typing

8.2 Object identity handling (Cyclic data structures)

9. Custom Handlers

9.1 Databinding, common

  • PropertyNamingStrategy (back-ref?)
  • Mix-Ins
  • Defaults:
    • InjectableValues
    • JsonInclude
    • DateFormat
    • TimeZone
    • Visibility

9.2 Deserialization

9.2.1 Custom deserializers

9.2.2 Value instantiators

9.2.3 Value injections

9.3 Serialization

9.3.1 Custom Serializers

9.3.2 Value instantiators

9.3.3 Filtering

9.4 Streaming parsing

NOTE: most configurable via ObjectMapper, ObjectReader

  • FormatFeatures too

9.5 Streaming generation

NOTE: most configurable via ObjectMapper, ObjectWriter

  • CharacterEscapes
  • PrettyPrinter
  • FormatFeatures too

9.6 Tree handling

  • JsonNodeFactory
  • Comparators?

10. Extensions

10.1 Datatype modules

10.2 Dataformat extensions

10.3 JAX-RS providers

10.4 JVM Language Support

  • Scala, Kotlin

10.5 Other extensions

  • Afterburner, Mr. Bean, JAXB Annotations
Clone this wiki locally