Jackson API Tutorials
Jackson Custom Deserializer
Jackson provides
JsonDeserializer
and its subclasses such as
StdDeserializer
to deserialize objects from JSON. We can register custom deserializer with
ObjectMapper
or using
@JsonDeserialize
annotation.
Jackson @JsonFilter Example
On this page we will provide Jackson
@JsonFilter
annotation example.
@JsonFilter
defines a filter name using which we filter out properties in JSON serialization.
Jackson @JsonFormat Example
On this page we will provide Jackson
@JsonFormat
example.
@JsonFormat
is used to decide how values of properties to be serialized.
Jackson Custom Serializer
This page will walk through Jackson custom serializer example. To create a custom serializer, we need to create a class by extending Jackson
StdSerializer
class and override its
serialize
method.
Jackson @JsonIgnore, @JsonIgnoreProperties and @JsonIgnoreType
This page will walk through Jackson
@JsonIgnore
,
@JsonIgnoreProperties
and
@JsonIgnoreType
annotations example. These annotations are used to ignore logical properties in JSON serialization and deserialization.
Jackson @JsonAnyGetter and @JsonAnySetter Example
On this page we will provide Jackson
@JsonAnyGetter
and
@JsonAnySetter
example.
@JsonAnyGetter
is annotated at non-static, no-argument method to serialize a Java
Map
into JSON.
Jackson @JsonProperty and @JsonAlias Example
On this page we will provide Jackson
@JsonProperty
and
@JsonAlias
annotation example.
@JsonProperty
defines a logical property used in serialization and deserialization of JSON.
Jackson @JacksonInject Example
This page will walk through Jackson
@JacksonInject
example.
@JacksonInject
annotation is used for indicating that value of annotated property will be injected.
Jackson Change Property Name
This page will walk through how to change property name using Jackson API. Jackson provides
@JsonProperty
annotation that is used to change property name in serialized JSON.
Jackson Ignore Null and Empty Fields
This page will walk through how to ignore Null and Empty fields using Jackson API. Jackson provides
Include.NON_NULL
to ignore fields with Null values and
Include.NON_EMPTY
to ignore fields with Empty values.
Jackson JsonNode.forEach() with Java 8 Consumer
Jackson has provided JsonNode.forEach() method which will accept Java 8 consumer definition to iterate each node. The consumer accepts only super classes of JsonNode.
Read/Write JSON Using Jackson ObjectMapper, JsonParser and JsonGenerator Example
This page will describe how to read JSON into Java object and write java object into JSON output using Jackson API. Jackson has different API like ObjectMapper, JsonParser and JsonGenerator etc.