Convert a JSON String to a HashMap

Here is an example of how you can convert a JSON string to a HashMap in Java:

import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;
import java.util.HashMap;

public class Main {
    public static void main(String[] args) throws IOException {
        String json = "{\"name\":\"John\",\"age\":30,\"city\":\"New York\"}";

        ObjectMapper mapper = new ObjectMapper();
        HashMap<String, Object> map = mapper.readValue(json, HashMap.class);

        System.out.println(map);
    }
}

This will output the following:

{name=John, age=30, city=New York}