code: public static Object deserialize(String json, String containerType, Class cls, NestedContent nestedContent) throws ApiException {
          try{
  
              if(("List".equals(containerType) || "Array".equals(containerType)) && nestedContent != null){
                  if(NestedContent.CONTEXT.equals(nestedContent)){
                      JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructFromCanonical("java.util.List<java.util.List<io.cortical.rest.model.Context>>");
                      Object response = (java.lang.Object) JsonUtil.getJsonMapper().readValue(json, typeInfo);
                      return response;
                  }else if(NestedContent.TERM.equals(nestedContent)){
                      JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructFromCanonical("java.util.List<java.util.List<io.cortical.rest.model.Term>>");
                      Object response = (java.lang.Object) JsonUtil.getJsonMapper().readValue(json, typeInfo);
                      return response;
                  }else{
                      return null;
                  }                        
                 
              }
              else if("List".equals(containerType) || "Array".equals(containerType)) {
                  JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructCollectionType(List.class, cls);
                  List response = (List<?>) JsonUtil.getJsonMapper().readValue(json, typeInfo);
                  return response;
              }
              else if(String.class.equals(cls)) {
                  if(json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1)
                      return json.substring(1, json.length() - 2);
                  else
                      return json;
              }
              else {
                  return JsonUtil.getJsonMapper().readValue(json, cls);
              }
          }
          catch (IOException e) {
              throw new ApiException(500, e.getMessage());
          }
      }
docs: Deserialize a received response String.
  @param json the received json String
  @param containerType the containerType
  @param cls the class of the object
  @param nestedContent contains the name of the Pojo, contained in a List of Lists. <code>null</code> if no nested content is present.
  @throws APIException if an exception occurs during deserialization