Skip to content
Advertisement

How to use Jackson to deserialise an array of objects

The Jackson data binding documentation indicates that Jackson supports deserialising “Arrays of all supported types” but I can’t figure out the exact syntax for this.

For a single object I would do this:

JavaScript

Now for an array I want to do this:

JavaScript

Anyone know if there is a magic missing command? If not then what is the solution?

Advertisement

Answer

First create a mapper :

JavaScript

As Array:

JavaScript

As List:

JavaScript

Another way to specify the List type:

JavaScript
Advertisement