Acquire an ObjectReader with ObjectMapper#readerFor(TypeReference) using a TypeReference describing the typed collection you want. Then use ObjectReader#readValue(JsonNode) to parse the JsonNode (presumably an ArrayNode).

For example, to get a List<String> out of a JSON array containing only JSON strings

CopyObjectMapper mapper = new ObjectMapper();
// example JsonNode
JsonNode arrayNode = mapper.createArrayNode().add("one").add("two");
// acquire reader for the right type
ObjectReader reader = mapper.readerFor(new TypeReference<List<String>>() {
});
// use it
List<String> list = reader.readValue(arrayNode);
Answer from Sotirios Delimanolis on Stack Overflow
Top answer
1 of 3
89

Acquire an ObjectReader with ObjectMapper#readerFor(TypeReference) using a TypeReference describing the typed collection you want. Then use ObjectReader#readValue(JsonNode) to parse the JsonNode (presumably an ArrayNode).

For example, to get a List<String> out of a JSON array containing only JSON strings

CopyObjectMapper mapper = new ObjectMapper();
// example JsonNode
JsonNode arrayNode = mapper.createArrayNode().add("one").add("two");
// acquire reader for the right type
ObjectReader reader = mapper.readerFor(new TypeReference<List<String>>() {
});
// use it
List<String> list = reader.readValue(arrayNode);
2 of 3
13

If an Iterator is more useful...

...you can also use the elements() method of ArrayNode. Example see below.

sample.json

Copy{
    "first": [
        "Some string ...",
        "Some string ..."
    ],
    "second": [
        "Some string ..."
    ]
}

So, the List<String> is inside one of the JsonNodes.

Java

When you convert that inner node to an ArrayNode you can use the elements() method, which returns an Iterator of JsonNodes.

CopyFile file = new File("src/test/resources/sample.json");
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonNode = mapper.readTree(file);
ArrayNode arrayNode = (ArrayNode) jsonNode.get("first");
Iterator<JsonNode> itr = arrayNode.elements();
// and to get the string from one of the elements, use for example...
itr.next().asText();

New to Jackson Object Mapper?

I like this tutorial: https://www.baeldung.com/jackson-object-mapper-tutorial

Update:

You can also use .iterator() method of ArrayNode. It is the same:

Same as calling .elements(); implemented so that convenience "for-each" loop can be used for looping over elements of JSON Array constructs.

from the javadocs of com.fasterxml.jackson.core:jackson-databind:2.11.0

🌐
Baeldung
baeldung.com › home › json › jackson › convert jackson jsonnode to typed collection
Convert Jackson JsonNode to Typed Collection | Baeldung
June 21, 2025 - For example, we could also use it for reverse comparison from a Java object to JsonNode. We can also provide a custom deserializer to perform the conversion. Let’s look at how we can define one: public class CustomPersonListDeserializer extends JsonDeserializer<List<Person>> { @Override public List<Person> deserialize(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.databind.DeserializationContext ctxt) throws IOException { ObjectMapper objectMapper = (ObjectMapper) p.getCodec(); List<Person> personList = new ArrayList<>(); JsonNode personsNode = objectMapper.readTree(p); for (JsonNode node : personsNode) { personList.add(objectMapper.readValue(node.traverse(), Person.class)); } return personList; } }
🌐
Java Code Geeks
javacodegeeks.com › home › core java
Jackson JsonNode to Java Collections - Java Code Geeks
July 8, 2024 - In this article, we explored various methods for converting Jackson JsonNode objects into typed Java collections. We discussed using ObjectMapper with TypeReference and readValue methods to transform JSON data into List and Map structures. Additionally, we demonstrated how to manually traverse JsonNode and employ custom deserializers for more complex scenarios.
🌐
Baeldung
baeldung.com › home › json › jackson › simplified array operations on jsonnode without typecasting in jackson
Simplified Array Operations on JsonNode Without Typecasting in Jackson | Baeldung
June 27, 2025 - StreamSupport is a utility class that provides static methods for creating Streams and Spliterators over various data structures, including collections, arrays, and specialized iterators. The string is deserialized into a JsonNode object using ObjectMapper. Here, we’re creating a Stream from the Spliterator of the objects array, and the elements are collected into the List<JsonNode>:
🌐
Red Hat
access.redhat.com › webassets › avalon › d › jboss_enterprise_application_platform_continuous_delivery › 19 › javadocs › com › fasterxml › jackson › databind › JsonNode.html
JsonNode (Red Hat JBoss Enterprise Application Platform 7.4.0.CD19 public API)
Iterator that can be used to traverse ... field is found in this node or its descendants, returns null. ... Method for finding JSON Object fields with specified name, and returning found ones as a List......
🌐
TutorialsPoint
tutorialspoint.com › how-to-convert-jsonnode-to-arraynode-using-jackson-api-in-java
How to convert JsonNode to ArrayNode using Jackson API in Java?
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.core.JsonProcessingException; public class JSonNodeToArrayNodeTest { public static void main(String args[]) throws JsonProcessingException { String jsonStr = "{\"Technologies\" : [\"Java\", \"Scala\", \"Python\"]}"; ObjectMapper mapper = new ObjectMapper(); ArrayNode arrayNode = (ArrayNode) mapper.readTree(jsonStr).get("Technologies"); if(arrayNode.isArray()) { for(JsonNode jsonNode : arrayNode) { System.out.println(jsonNode); } } } }
🌐
Tabnine
tabnine.com › home page › code › java › com.fasterxml.jackson.databind.jsonnode
com.fasterxml.jackson.databind.JsonNode.isArray java code examples | Tabnine
@Override public RangeBoundValue deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { JsonNode node = jp.getCodec().readTree(jp); if (node.isNull()) { return null; } else { List<Object> list; if (node.isArray()) { list = new ArrayList<>(); Iterator<JsonNode> iter = node.elements(); while (iter.hasNext()) { Object v = toValue(iter.next()); list.add(v); } } else { Object v = toValue(node); list = ImmutableList.of(v); } return new RangeBoundValue(list); } }
Find elsewhere
🌐
javathinking
javathinking.com › blog › convert-jsonnode-to-list-java
Convert JsonNode to List in Java — javathinking.com
Common implementations of the List interface include ArrayList and LinkedList. The process of converting a JsonNode to a List involves iterating over the elements of the JsonNode (if it is an array) and extracting the values to populate the List.
🌐
GitHub
github.com › json-path › JsonPath › issues › 160
Accept Jackson's JsonNode and return List<JsonNode> · Issue #160 · json-path/JsonPath
December 2, 2015 - You must be signed in to change notification settings · Fork 1.7k · Star 9.3k · New issueCopy link · New issueCopy link · Closed · Closed · Accept Jackson's JsonNode and return List<JsonNode>#160 · Copy link · oleg-gr · opened · on Dec 2, 2015 · Issue body actions ·
Author   oleg-gr
🌐
Fasterxml
fasterxml.github.io › jackson-databind › javadoc › 2.7 › com › fasterxml › jackson › databind › JsonNode.html
JsonNode (jackson-databind 2.7.0 API)
Iterator that can be used to traverse ... field is found in this node or its descendants, returns null. ... Method for finding JSON Object fields with specified name, and returning found ones as a List......
🌐
Baeldung
baeldung.com › home › json › jackson › get all the keys in a json string using jsonnode
Get all the Keys in a JSON String Using JsonNode | Baeldung
May 11, 2024 - We can use the fieldNames() method on a JsonNode instance to fetch the nested field names. It returns names of direct nested fields only. ... public List<String> getKeysInJsonUsingJsonNodeFieldNames(String json, ObjectMapper mapper) throws ...
🌐
Javadoc.io
javadoc.io › doc › com.fasterxml.jackson.core › jackson-databind › 2.9.5 › com › fasterxml › jackson › databind › JsonNode.html
JsonNode - jackson-databind 2.9.5 javadoc
Bookmarks · Latest version of com.fasterxml.jackson.core:jackson-databind · https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind · Current version 2.9.5 · https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind/2.9.5 · package-list path (used for javadoc generation ...
🌐
Fasterxml
fasterxml.github.io › jackson-databind › javadoc › 2.8 › com › fasterxml › jackson › databind › JsonNode.html
JsonNode (jackson-databind 2.8.0 API)
Iterator that can be used to traverse ... field is found in this node or its descendants, returns null. ... Method for finding JSON Object fields with specified name, and returning found ones as a List......
🌐
Javadoc.io
javadoc.io › doc › com.fasterxml.jackson.core › jackson-databind › 2.9.8 › com › fasterxml › jackson › databind › JsonNode.html
JsonNode - jackson-databind 2.9.8 javadoc
Bookmarks · Latest version of com.fasterxml.jackson.core:jackson-databind · https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind · Current version 2.9.8 · https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind/2.9.8 · package-list path (used for javadoc generation ...