Jackson: how to exclude null value properties from JSON serialization

In the comments to a previous article about the Jackson library, it had been raised the question on how to exclude from the JSON serialization of a Java object properties that had a null value. Since it was not the first time I received a request for clarification on the subject, I decided to deal with it … (Read the full article)

Jackson: using @JsonSerialize (or @JsonDeserialize) annotation to register a custom serializer (or deserializer)

In a previous post we saw how to create a custom JSON serializer (and also a custom deserializer) with Jackson and how to register it using the SimpleModule class. This approach, only possible starting from version 1.7, is defined by Jackson wiki page as the “recommended way to register a custom… (Read the full article)

Jackson: create a custom JSON deserializer with StdDeserializer and JsonToken classes

In the previous post we saw how to create a custom JSON serializer with Jackson, in order to handle in a desired way the objects of a given class and get a representation of them different from the default one. This new article is its natural continuation so we’ll analyze the opposite process, creating… (Read the full article)

Jackson: create and register a custom JSON serializer with StdSerializer and SimpleModule classes

During Java objects JSON serialization sometimes we may need to change the default behavior and provide a customized representation of a class object or a collection. In this new (article about Jackson library we see how to implement a custom serializer, starting once again with a concrete example.… (Read the full article)

Jackson: using @JsonIgnore and @JsonProperty annotations to exclude a property only from JSON deserialization

In the previous article we saw how and where to use the Jackson @JsonIgnore annotation to exclude a property of an Java object from the JSON serialization. Not being available, the value of that property, during deserialization will be set to the default value in accordance with its type. In this case,… (Read the full article)

Jackson JSON: difference between @JsonIgnore and @JsonIgnoreProperties annotations

Jackson has two different annotations to use when you want to exclude some class members from the JSON serialization and deserialization processes. These two annotations are @JsonIgnore and @JsonIgnoreProperties.
@JsonIgnoreProperties is an annotation at the class level and it expects that … (Read the full article)

Jackson JSON: deserialize a list of objects of subclasses of an abstract class

In this post we see how to serialize and deserialize in JSON a Java class that declares an instance variable consisting in a list of objects of an abstract class that contains objects of its various concrete subclasses.
We start by creating our abstract class:

public abstract class MyItem {

    private int
(Read the full article)

Serializzazione e deserializzazione JSON di oggetti Java con Jackson: un esempio concreto

[This article is available also in ENGLISH: JSON serialization and deserialization of JAVA objects with Jackson: a concrete example]

In questo post vediamo come utilizzare il framework Jackson per serializzare dei semplici oggetti Java (POJO – Plain Old Java Object) in JSON (JavaScript … (Read the full article)