code: public String toJson(T instance)
              throws IllegalArgumentException
      {
          try {
              return mapper.writeValueAsString(instance);
          }
          catch (IOException e) {
              throw new IllegalArgumentException(format("%s could not be converted to JSON", instance.getClass().getName()), e);
          }
      }
docs: Converts the specified instance to json.
  
  @param instance the instance to convert to json
  @return json string
  @throws IllegalArgumentException if the specified instance can not be converted to json