ObjectMapper objectMapper = new ObjectMapper();
String containerMatrixJSON = "{\"container_metrics\":{\"cpuRequest\":{\"results\":{\"general_info\":{\"sum\":4.4,\"mean\":1.1,\"units\":\"cores\"}}},\"cpuLimit\":{\"results\":{\"general_info\":{\"sum\":2,\"mean\":0.5,\"units\":\"cores\"}}},\"cpuUsage\":{\"results\":{\"general_info\":{\"max\":0.84,\"mean\":0.12,\"units\":\"cores\"}}},\"cpuThrottle\":{\"results\":{\"general_info\":{\"max\":0.09,\"mean\":0.045,\"units\":\"cores\"}}},\"memoryRequest\":{\"results\":{\"general_info\":{\"sum\":250.85,\"mean\":50.21,\"units\":\"MiB\"}}},\"memoryLimit\":{\"results\":{\"general_info\":{\"sum\":500,\"mean\":100,\"units\":\"MiB\"}}},\"memoryUsage\":{\"results\":{\"general_info\":{\"max\":198.5,\"mean\":40.1,\"units\":\"MiB\"}}},\"memoryRSS\":{\"results\":{\"general_info\":{\"max\":123.6,\"mean\":31.91,\"units\":\"MiB\"}}}}}";
// convert json string to map
HashMap<String, HashMap<String, HashMap<String, GeneralInfoResult>>> contData = (HashMap<String, HashMap<String, HashMap<String, CustomClass>>>) objectMapper.readValue(containerMatrixJSON, Map.class); System.out.println("Map = "+contData);

Method #2

public static void main(String[] args) throws IOException {

Map<String,String> map = new HashMap<String,String>(); ObjectMapper mapper = new ObjectMapper(); map = mapper.readValue(x, new TypeReference<HashMap>(){});

System.out.println(map);

}