Object Mapper Utilities

List to JsonNode conversion

List<Map<String, Object>> list  = new ArrayList<>();
ObjectMapper mapper = new ObjectMapper();
JsonNode node = mapper.convertValue(list,  new TypeReference<JsonNode>(){});

Jsonfile to Java Map Conversion

public static Map<String, Object> jsonFileToMap(String path) throws IOException {
  ClassLoader cl = CLASSNAME.class.getClassLoader();
  File localFile = new File(cl.getResource(path).getFile());
  ObjectMapper mapper = new ObjectMapper();
  return mapper.readValue(localFile, new TypeReference<Map<String, Object>>() {});
}

String to Map Conversion

public static Map<String, Object> stringToMap(String path) throws IOException {
  ObjectMapper mapper = new ObjectMapper().configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
  return mapper.readValue(path, new TypeReference<Map<String, Object>>() {});
}