code: public Object serialize(Object obj, String contentType, Map<String, Object> formParams) throws ApiException {
      if (contentType.startsWith("multipart/form-data")) {
        FormDataMultiPart mp = new FormDataMultiPart();
        for (Entry<String, Object> param: formParams.entrySet()) {
          if (param.getValue() instanceof File) {
            File file = (File) param.getValue();
            mp.bodyPart(new FileDataBodyPart(param.getKey(), file, MediaType.MULTIPART_FORM_DATA_TYPE));
          } else {
            mp.field(param.getKey(), parameterToString(param.getValue()), MediaType.MULTIPART_FORM_DATA_TYPE);
          }
        }
        return mp;
      } else if (contentType.startsWith("application/x-www-form-urlencoded")) {
        return this.getXWWWFormUrlencodedParams(formParams);
      } else if (contentType.startsWith("text/csv")) {
        return this.serializeToCsv(obj);
      } else {
        // We let Jersey attempt to serialize the body
        return obj;
      }
    }
docs: Serialize the given Java object into string according the given
  Content-Type (only JSON is supported for now).