Create common ObjectMapper method for deserializing across multiple POJO classes

I tried with this and it seems working properly. For more details, you can check https://www.tabnine.com/code/java/methods/com.fasterxml.jackson.databind.ObjectMapper/getTypeFactory?snippet=5ce6b2a237d9ff0004dd4adf.

public static <T> T deserializeObject(String json, Class<T> cls) {
    T result = null;
    JavaType javaType = objectMapper.getTypeFactory().constructType(cls);
    try {
      result = objectMapper.readValue(json, javaType);
    } catch (IOException e) {
      log.error("An error occurred during object deserialization", e);
    }
    return result;
  }