[Update Sept 2020] Although my original answer here, from many years ago, seems to be helpful and is still getting upvotes, I now use the GSON library from Google, which I find to be more intuitive.

I've got the following code:

public void testJackson() throws IOException {  
    ObjectMapper mapper = new ObjectMapper(); 
    File from = new File("albumnList.txt"); 
    TypeReference<HashMap<String,Object>> typeRef 
            = new TypeReference<HashMap<String,Object>>() {};

    HashMap<String,Object> o = mapper.readValue(from, typeRef); 
    System.out.println("Got " + o); 
}   

It's reading from a file, but mapper.readValue() will also accept an InputStream and you can obtain an InputStream from a string by using the following:

new ByteArrayInputStream(astring.getBytes("UTF-8")); 

There's a bit more explanation about the mapper on my blog.

Answer from djna on Stack Overflow
🌐
Mkyong
mkyong.com › home › java › convert json string to map using jackson
Convert JSON string to Map using Jackson - Mkyong.com
April 23, 2024 - String json = "..."; ObjectMapper mapper = new ObjectMapper(); // convert JSON string to Map Map<String, Object> map = mapper.readValue(json, new TypeReference<>() {}); ... package com.mkyong.json.jackson; import com.fasterxml.jackson.core....
🌐
Educative
educative.io › answers › how-to-convert-a-json-string-to-a-map-using-jackson
How to convert a JSON string to a map using Jackson
Below are the steps to get a map from a JSON string. Add the following dependency to the pom.xml file. <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.13.0-rc1</version> </dependency>
🌐
DigitalOcean
digitalocean.com › community › tutorials › jackson-json-java-parser-api-example-tutorial
Jackson JSON Java: Parser API Examples & Tutorial | DigitalOcean
August 3, 2022 - jackson-databind jar depends on ... you add all three otherwise you will get runtime error. Jackson JSON Parser API provides easy way to convert JSON to POJO Object and supports easy conversion to Map from JSON data....
🌐
Stack Abuse
stackabuse.com › convert-json-string-to-java-map-with-jackson
Convert JSON String to Java Map with Jackson
March 16, 2023 - Naturally, Jackson's key class ... other types, to convert JSON contents into a Java Map, you'll use the readValue() method of the ObjectMapper instance, which deserializes it into the provided class reference:...
🌐
Attacomsian
attacomsian.com › blog › jackson-convert-json-string-to-map
Convert JSON String to Map using Jackson
October 14, 2022 - <dependency> <groupId>com.fast... a JSON string to a Java Map with the same properties and keys, you can use the readValue() method from ObjectMapper:...
🌐
Baeldung
baeldung.com › home › json › jackson › intro to the jackson objectmapper
Intro to the Jackson ObjectMapper | Baeldung
December 9, 2025 - Always use the latest versions from the Maven central repository for jackson-databind. Let’s start with the basic read and write operations. The simple readValue API of the ObjectMapper is a good entry point. We can use it to parse or deserialize JSON content into a Java object.
🌐
Jenkov
jenkov.com › tutorials › java-json › jackson-objectmapper.html
Jackson ObjectMapper
You can convert a JsonNode to a Java object, using the Jackson ObjectMapper treeToValue() method. This is similar to parsing a JSON string (or other source) into a Java object with the Jackson ObjectMapper.
Find elsewhere
🌐
Reflectoring
reflectoring.io › jackson
All You Need To Know About JSON Parsing With Jackson
July 14, 2022 - We can choose to parse the JSON ... from the JSON file we are trying to parse. ObjectMapper will turn the name of each variable in the JSON to a Map key and the value of that variable to the value of that key. public class JacksonTest { ......
🌐
DEV Community
dev.to › itzg › jackson-json-parsing-top-level-map-into-records-4e9j
Jackson JSON parsing top-level map into records - DEV Community
June 7, 2022 - record People( @JsonAnySetter // (1) Map<String, Person> people ) { public People { people = new HashMap<>(); // (2) } } record Person( int age ) { } For example, following use of an ObjectMapper ... final People people = objectMapper.readValue(""" ...
🌐
Baeldung
baeldung.com › home › json › jackson › reading json documents as maps and comparing them
Reading JSON Documents as Maps and Comparing Them | Baeldung
January 18, 2024 - Here, we’re using the readValue() method from the ObjectMapper class to convert the JSON document to a Map. It takes the JSON document as a File object and a TypeReference object as parameters.
🌐
HowToDoInJava
howtodoinjava.com › home › jackson › jackson – marshal and unmarshal java maps
Jackson - Marshal and Unmarshal Java Maps - HowToDoInJava
August 20, 2022 - we are using TypeReference which is used to describe the type of our destination class type. String json = "{\"id\":\"1\",\"name\":\"Lokesh Gupta\",\"age\":34,\"location\":\"India\"}"; ObjectMapper mapper = new ObjectMapper(); HashMap<String, ...
🌐
TutorialsPoint
tutorialspoint.com › article › convert-json-to-from-map-using-jackson-library-in-java
Convert JSON to/from Map using Jackson library in Java?
May 12, 2025 - JSON is a format that is used to exchange data between a server and a client. It is lightweight and easy to read and write. In Java, we can convert JSON to/from Map using various libraries. In this article, we will discuss how to convert JSON to/from Map using the Jackson library.
🌐
Baeldung
baeldung.com › home › json › jackson › map serialization and deserialization with jackson
Map Serialization and Deserialization with Jackson | Baeldung
January 8, 2024 - In this quick tutorial, we’ll look at the serialization and deserialization of Java maps using Jackson. We’ll illustrate how to serialize and deserialize Map<String, String>, Map<Object, String>, and Map<Object, Object> to and from JSON-formatted Strings.
🌐
Mkyong
mkyong.com › home › java › how to parse json string with jackson
How to parse JSON string with Jackson - Mkyong.com
April 23, 2024 - package com.mkyong.json.jackson; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; public class BasicJsonStringExample { public static void main(String[] args) { try { // a simple JSON string String json = "{\"name\": \"mkyong\", \"age\": 20}"; // Jackson main object ObjectMapper mapper = new ObjectMapper(); // read the json strings and convert it into JsonNode JsonNode node = mapper.readTree(json); // display the JsonNode System.out.println("Name: " + node.get("name").asText()); System.out.println("Age: " + node.get("age").asInt()); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } }
🌐
Java Guides
javaguides.net › 2019 › 07 › jackson-convert-json-string-to-map.html
Jackson – Convert JSON string to Map
July 21, 2019 - In this quick article, I will show how to convert a JSON string to Java Map using the Jackson library. In Jackson, we can use a mapper.readValue(json, Map.class) to convert a JSON string to a Map Check out complete Jackson tutorial at Java Jackson ...
🌐
Codemia
codemia.io › knowledge-hub › path › how_to_convert_a_json_string_to_a_mapstring_string_with_jackson_json
How to convert a JSON string to a Map ...
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises
🌐
Stack Overflow
stackoverflow.com › questions › 66878886 › how-do-i-parse-the-properties-of-a-json-object-into-a-map-using-jackson
java - How do I parse the properties of a json object into a map using Jackson - Stack Overflow
For parsing maps there are several ways, one would be readTree() which basically returns a hierarchy of maps and lists but you could also use a TypeReference<Map<String, Integer>> or parse MapTestClass and annotate answers appropriately (e.g. with ...