Jackson - The Complete Guide in 20 Parts

Jackson - The Complete Guide in 20 Parts

Hello!

This is a post from the Jackson Series: Jackson - The Complete Guide in 20 Parts

In the today's post we're going to see an Introduction to Jackson Java Library and how to configure it with Maven and Gradle!

1 - Intro to Jackson and Configuration with Maven

Jackson in one of the most used Library in Java to parse Java Objects into JSON. Actually Jackson ca be used to do really more than that as:

  • Data processing with many types such as Avro, XML and CSV
  • Data formatting
  • Data binding
  • Data streaming

Each of these components has its own project. For example, to work with Jackson YAML, XML and Avro, you will find the following great projects:

  • Jackson Data Format for XML in GitHub
  • Jackson Data Format Binary in GitHub
  • Jackson Data Format Text in GitHub

We have 3 main packages in Jackson, that have its own projects also:

This project defines the Streaming API with Parser and Generator abstractions used by Jackson Processor

This Jackson Core can be configured with Maven as below:

If you prefer Gradle:

Jackson has a special project to deal with Annotations. This project depends on Jackson Core project.

In this project we have the basics and more advanced annotations. To configure the Jackson Annotations project we just need to use the following Maven dependency:

If you prefer Gradle:

This is a project that has a general Data Binding for Jackson and uses the project Jackson Core

Notice that Jackson Data Binding can work with other types rather than just JSON.

To use the Data Binding project we can just configure the Maven Dependency as below:

If you prefer Gradle:

This project uses the Jackson Core and Jackson Annotation projects as dependency but you don't need to worry about this dependencies, since Maven will download them for us : )

That's it for today folks!

Let's learn about JSON Serialization in the next part: Part 2 - Simple Serialization into JSON with Jackson

Follow us to keep up to date! \o/

Alexandre Gama

Alexandre Gama

Hacking Code Founder

Hacking Code Founder and Writer, Passionate Senior Software Engineer and Team Leader at @Elo7, Teacher of several courses at Caelum, Speaker at many conferences and terrible guitar player.
Jackson JSON Serialization - Java Tutorial - Hacking Code

Part 2 - Simple Serialization into JSON with Jackson

It's time to see the first JSON Serialization with Jackson!

Jackson Pretty JSON Serialization - Java Tutorial - Hacking Code

Part 3 - Printing a Pretty JSON with Jackson

Did your JSON is being printed in a ugly way? Let's see a Pretty JSON Serialization with Jackson

Jackson Composed Objects JSON Serialization - Java Tutorial - Hacking Code

Part 4 - Serializing Composed Java Objects with Jackson

What about serialize a Composed Objects in Java with Jackson?

Jackson Getter JSON Deserialization - Java Tutorial - Hacking Code

Part 5 - Serializing Getter Methods to JSON with Jackson

Let's see hows does getter Serialization with Jackson work!

Jackson Field JSON Serialization - Java Tutorial - Hacking Code

Part 6 - Serializing Java Object into JSON using Fields with Jackson

It's time to serialize Fields to JSON using Jackson

Jackson JSON Ordering Serialization - Java Tutorial - Hacking Code

Part 7 - Ordering Properties in JSON with Jackson Serialization

Did you know that you can Order attributes in JSON with Jackson?

Jackson JSON Raw Content Serialization - Java Tutorial - Hacking Code

Part 8 - Serializing the Raw Content in the JSON with Jackson

Jackson allows us to Serialize that Raw Content of the Java Object!

Jackson Custom Value Serializer - Java Tutorial - Hacking Code

Part 9 - JSON Object with a Custom Value with Jackson

You can serialize the entire object with a custom method with Jackson!

Jackson Root JSON Serialization - Java Tutorial - Hacking Code

Part 10 - JSON Object with a Root with Jackson

Root Serialization is really common in the JSON World. Let's see how Jackson does that!

Jackson Custom JSON Serializer - Java Tutorial - Hacking Code

Part 11 - JSON Custom Serializer with Jackson

Custom Serializer with Jackson is really great! Let's see how to use it!

Jackson JSON Map Serialization - Java Tutorial - Hacking Code

Part 12 - Map into JSON Objects with Jackson

Serializing Map in JSON with Jackson is really easy!

Jackson Ignoring JSON Properties - Java Tutorial - Hacking Code

Part 13 - Ignoring Properties in JSON with Jackson

Let's learn how to configure properties to be ignored in the JSON Serialization with Jackson

Jackson Enum JSON Serialization - Java Tutorial - Hacking Code

Part 14 - Enum Objects into a JSON with Jackson

Did you try to Serialize an Enum to JSON? It's pretty easy with Jackson!

Jackson Deserialization - Java Tutorial - Hacking Code

Part 15 - Jackson Deserialization with ObjectMapper

Is it easy to Deserialize a JSON to a Java Object? Let's see how with Jackson!

Jackson Custom JSON Deserialization - Java Tutorial - Hacking Code

Part 16 - Jackson Deserialization with @JsonSetter

Let's see how Custom JSON Deserialization works with Jackson with @JsonSetter

Jackson Injected JSON Deserialization - Java Tutorial - Hacking Code

Part 17 - Jackson Deserialization with @JacksonInject

Did you know that you can have a value being injected in the generated JSON with Jackson?

Jackson Custom JSON Construction - Java Tutorial - Hacking Code

Part 18 - Jackson Deserialization with @JsonCreator

Jackson Deserialization with @JsonCreator allows us to create a custom constructor

Jackson Map JSON Deserialization - Java Tutorial - Hacking Code

Part 19 - Deserializing Map from a JSON with Jackson

Jackson Map JSON Deserialization to Java Objects can be really easy with Jackson

Jackson Custom JSON Deserialization - Java Tutorial - Hacking Code

Part 20 - Jackson Deserialization with @JsonDeserialize

Jackson Custom JSON Deserialization bring to use power to serialize JSON that doesn't mathc with our expectation

0 Comments

Trackbacks/Pingbacks

  1. Part 6 – Serializing Java Object into JSON using Fields with Jackson | Hacking Code - […] Part 1 - Intro to Jackson and Configuration with Maven and Gradle […]
  2. Part 4 – Serializing Composed Java Objects with Jackson | Hacking Code - […] Part 1 - Intro to Jackson and Configuration with Maven and Gradle […]

Leave a Reply

Share This
Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

%d bloggers like this: