Inheritance with Jackson 1. Overview In this article, we’ll have a look at working with class hierarchies in Jackson. Two typical use cases are the inclusion of subtype metadata and ignoring properties inherited from superclasses. We’re going to describe those two scenarios and a couple of circumstances where special treatment… Continue Reading jackson-inheritance

Jackson – Bidirectional Relationships 1. Overview In this tutorial, we’ll go over the best ways to deal with bidirectional relationships in Jackson. We’ll discuss the Jackson JSON infinite recursion problem, then – we’ll see how to serialize entities with bidirectional relationships and finally – we will deserialize them. 2. Infinite… Continue Reading jackson-bidirectional-relationships-and-infinite-recursion

Jackson JSON Views 1. Overview In this tutorial, we’ll go over how to use Jackson JSON Views to serialize/deserialize objects, customize the views and finally – how to start integrating with Spring. 2. Serialize Using JSON Views First – let’s go through a simple example – serialize an object with… Continue Reading jackson-json-view-annotation

Jackson Support for Kotlin 1. Overview In this tutorial, we’ll discuss the Jackson support for Kotlin. We’ll explore how to serialize and deserialize both Objects and Collections. We’ll also make use of @JsonProperty and @JsonInclude annotations. 2. Maven Configuration First, we need to add the jackson-module-kotlin dependency to our pom.xml:… Continue Reading jackson-kotlin

Mapping a Dynamic JSON Object with Jackson 1. Introduction Working with predefined JSON data structures with Jackson is straightforward. However, sometimes we need to handle dynamic JSON objects, which have unknown properties. In this short tutorial, we’ll see multiple ways of mapping dynamic JSON objects into Java classes. Note that in… Continue Reading jackson-mapping-dynamic-object

Compare Two JSON Objects with Jackson 1. Overview In this article, we’ll have a look at comparing two JSON objects using Jackson – a JSON processing library for Java. 2. Maven Dependency First, let’s add the jackson-databind Maven dependency: <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.9.8</version> </dependency> 3. Using Jackson to Compare Two… Continue Reading jackson-compare-two-json-objects