First create a mapper :

import com.fasterxml.jackson.databind.ObjectMapper;// in play 2.3
ObjectMapper mapper = new ObjectMapper();

As Array:

MyClass[] myObjects = mapper.readValue(json, MyClass[].class);

As List:

List<MyClass> myObjects = mapper.readValue(jsonInput, new TypeReference<List<MyClass>>(){});

Another way to specify the List type:

List<MyClass> myObjects = mapper.readValue(jsonInput, mapper.getTypeFactory().constructCollectionType(List.class, MyClass.class));
Answer from Programmer Bruce on Stack Overflow
🌐
Baeldung
baeldung.com › home › json › jackson › intro to the jackson objectmapper
Intro to the Jackson ObjectMapper | Baeldung
December 9, 2025 - String jsonCarArray = "[{ \"color\" : \"Black\", \"type\" : \"BMW\" }, { \"color\" : \"Red\", \"type\" : \"FIAT\" }]"; ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.USE_JAVA_ARRAY_FOR_JSON_ARRAY, ...
Discussions

java - How to parse a JSON string to an array using Jackson - Stack Overflow
Which is the simplest way to do it using Jackson ObjectMapper? More on stackoverflow.com
🌐 stackoverflow.com
java - Jackson ObjectMapper deserialize object with array - Stack Overflow
Communities for your favorite technologies. Explore all Collectives · Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work More on stackoverflow.com
🌐 stackoverflow.com
November 25, 2016
How to parse Json array with 2 or more different types using Jackson?

http://www.baeldung.com/jackson-inheritance

You'll need to have those types inherit from one base class though.

Also; that is really bad JSON.

More on reddit.com
🌐 r/javahelp
11
4
January 15, 2018
java - Make Jackson interpret single JSON object as array with one element - Stack Overflow
Is there a way to make Jackson interpret single JSON object as an array with one element and vice versa? Example, I have 2 slightly different formats of JSON, I need both to map to same Java objec... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Attacomsian
attacomsian.com › blog › jackson-create-json-array
How to create a JSON array using Jackson
October 14, 2022 - try { // create `ObjectMapper` instance ObjectMapper mapper = new ObjectMapper(); // create three JSON objects ObjectNode user1 = mapper.createObjectNode(); user1.put("id", 1); user1.put("name", "John Doe"); ObjectNode user2 = mapper.createObjectNode(); user2.put("id", 2); user2.put("name", "Tom Doe"); ObjectNode user3 = mapper.createObjectNode(); user3.put("id", 3); user3.put("name", "Emma Doe"); // create `ArrayNode` object ArrayNode arrayNode = mapper.createArrayNode(); // add JSON users to array arrayNode.addAll(Arrays.asList(user1, user2, user3)); // convert `ArrayNode` to pretty-print JSON // without pretty-print, use `arrayNode.toString()` method String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(arrayNode); // print json System.out.println(json); } catch (Exception ex) { ex.printStackTrace(); }
🌐
Jenkov
jenkov.com › tutorials › java-json › jackson-objectmapper.html
Jackson ObjectMapper
The Jackson ObjectMapper can also read a Java List of objects from a JSON array string. Here is an example of reading a List of objects from a JSON array string:
🌐
Baeldung
baeldung.com › home › json › jackson › jackson – unmarshall to collection/array
Jackson - Unmarshall to Collection/Array | Baeldung
April 26, 2024 - Reading the same JSON Array into a Java Collection is a bit more difficult – by default, Jackson will not be able to get the full generic type information and will instead create a collection of LinkedHashMap instances: @Test public void givenJsonArray_whenDeserializingAsListWithNoTypeInfo_thenNotCorrect() throws JsonParseException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(); List<MyDto> listOfDtos = Lists.newArrayList( new MyDto("a", 1, true), new MyDto("bc", 3, false)); String jsonArray = mapper.writeValueAsString(listOfDtos); List<MyDto> asList = mapper.readValue(jsonArray, List.class); assertThat((Object) asList.get(0), instanceOf(LinkedHashMap.class)); }
🌐
W3Docs
w3docs.com › java
How to use Jackson to deserialise an array of objects
Here's an example of how you can do this: ObjectMapper mapper = new ObjectMapper(); User[] users = mapper.readValue(jsonString, User[].class); The readValue() method takes the JSON string as input and the target class (in this case, User[].class) ...
🌐
Spring Framework Guru
springframework.guru › home › how to the jackson object mapper with json
How to The Jackson Object Mapper with JSON - Spring Framework Guru
October 22, 2024 - Using the same Map structure as the previous example, we simply create two Java Maps and add them to a list. You can see from the output the objectMapper created a JSON array from the Java List.
Find elsewhere
🌐
Stack Abuse
stackabuse.com › converting-json-array-to-a-java-array-or-list
Convert JSON Array to a Java Array or List with Jackson
September 8, 2020 - Since we're mapping to an array of Language, we'll also specify this in the readValue() method: // It's advised to use ObjectMapper as a singleton and reuse the instance final ObjectMapper objectMapper = new ObjectMapper(); Language[] langs = objectMapper.readValue(json, Language[].class); ...
🌐
DEV Community
dev.to › abharangupta › dive-into-jackson-for-json-in-java-understanding-jsonnode-arraynode-and-objectmapper-30g4
Dive into Jackson for JSON in Java: Understanding JsonNode, ArrayNode, and ObjectMapper - DEV Community
October 22, 2024 - In this article, I'm going to walk you through some Jackson basics, like JsonNode, ArrayNode, and the ObjectMapper. We'll keep it simple, with easy code examples and outputs to show you exactly how things work.
🌐
GitHub
gist.github.com › KlausBrunner › 9915362
Incrementally binding JSON objects in an array (list) using Jackson. · GitHub
April 16, 2021 - Incrementally binding JSON objects in an array (list) using Jackson. - JacksonStreamingBindingTest.java
🌐
Mkyong
mkyong.com › home › java › how to parse json array with jackson
How to parse JSON Array with Jackson | mkyong.com
April 23, 2024 - ... package com.mkyong.json.jackson; ... args) throws JsonProcessingException { String jsonArray = "[{\"name\":\"mkyong\", \"age\":42}, {\"name\":\"ah pig\", \"age\":20}]"; ObjectMapper mapper = new ObjectMapper(); // ...
🌐
Java Code Geeks
examples.javacodegeeks.com › home › java development › core java › json › jackson
Jackson ObjectMapper - Examples Java Code Geeks - 2026
June 19, 2020 - The ObjectMapper class also provides methods to create ObjectNode and ArrayNode and generate a JSON structure as a combination of JsonNode objects.
🌐
Edureka Community
edureka.co › home › community › categories › java › using jackson to deserialise an array of object
Using Jackson to deserialise an array of object | Edureka Community
September 26, 2018 - For a single object I would do this: //json input { "id" : "junk", "stuff" : "bread" } / ... = ? Can anyone help me to find out the missing command?
🌐
Readthedocs
jse.readthedocs.io › en › latest › utils › jackson › jacksonObjectMapper.html
Jackson ObjectMapper — Java Repositories 1.0 documentation
String jsonCarArray = "[{ \"color\" ..._FOR_JSON_ARRAY, true); Car[] cars = objectMapper.readValue(jsonCarArray, Car[].class); String jsonCarArray = "[{ \"color\" : \"Black\", \"type\" : \"BMW\" }, { \"color\" : \"Red\", \"type\" : \"FIAT\" }]"; ObjectMapper objectMapper = new ObjectMapper(); ...
🌐
Reddit
reddit.com › r/javahelp › how to parse json array with 2 or more different types using jackson?
r/javahelp on Reddit: How to parse Json array with 2 or more different types using Jackson?
January 15, 2018 -

Hi guys, I've been searching online and stackoverflow but can't seem to find an answer to this. Basically the API i'm calling returns a json array as the root object. The two objects inside this array are different types. I have defined two Java classes to represent these two types and I'm wanting to read the json and convert them into my java object with jackson. Seems like there isn't a way to do this??

simple example of my objects:

class Type1 {
  String name
}

class Type2 {
  long age
}

The json coming from the api looks like this:

[
 {
    "name" : "mickey"
  },
  {
    "age" : 100
  }
]

How can I tell jackson to read in this "tree" but convert it to some object that is holding these two?

EDIT Here is a reply I made to another comment:

Ok, it seems like nobody is understanding what I'm saying. For one, I don't have control of the api I'm calling. I get what I get and have to deal with it.

What that api returns is a json ARRAY as the ROOT object. There are two objects in that array. Those two objects are NOT the same types.

IF that array was holding objects of the same type, i could do this:

MyObjects[] myobjs = new Objectmapper().readValue("some json array here", MyObjects[].class);

But like I said, i can't do this. Because the array is not holding objects of the same type. It would be more akin to a tuple like in python.

🌐
GeeksforGeeks
geeksforgeeks.org › java › deserialize-json-array-to-a-single-java-object-with-jackson
Deserialize JSON Array to a Single Java Object with Jackson - GeeksforGeeks
July 23, 2025 - In this example, we use the readValue() method of the ObjectMapper class to deserialize the JSON array into an array of Person objects.
🌐
Medium
medium.com › @Mohd_Aamir_17 › mastering-json-in-java-a-comprehensive-guide-to-handling-json-objects-arrays-and-nodes-with-df57bf0ebff1
Mastering JSON in Java: A Comprehensive Guide to Handling JSON Objects, Arrays, and Nodes with Jackson | by Mohd Aamir | Medium
November 4, 2024 - This article offers an in-depth look at how to parse, create, and manipulate JSON objects, arrays, and nodes using the Jackson library, covering advanced scenarios to equip you with the tools to tackle complex JSON data in Java. While Java has several libraries for JSON handling — such as Gson, org.json, and JSON-P — Jackson stands out for its performance, extensive feature set, and flexibility. Jackson’s ObjectMapper, JsonNode, ObjectNode, and ArrayNode classes provide a robust way to work with JSON data dynamically or in a structured manner.