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: set BigDecimal as type for JSON deserialization of decimal numbers

In the JSON serialization of a decimal number, Jackson creates an object of the exact actual type used when the field is defined in the class. If the field is defined by a generic type or by an abstraction, Jackson as default deserializes the value as Double.
In the following example we define in our class… (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: 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)