code: public String encodeJson(Object value, String type) throws UnsupportedEncodingException {
          jsonConverter.setType(type);
  
          String jsonValue;
          if (value == null) {
              jsonValue = "null";
          }
          else {
              jsonValue = jsonConverter.getAsString(null, null, value);
          }
  
          return URLEncoder.encode(jsonValue, encoding);
      }
docs: Convertes give value to JSON and encodes the converted value with a proper encoding. Data type is sometimes required, especially for Java generic types,
  because type information is erased at runtime and the conversion to JSON will not work properly.
  
  @param value value to be converted and encoded
  @param type data type of the value object. Any primitive type, array, non generic or generic type is supported. Data type is sometimes required to
  convert a value to a JSON representation. All data types should be fully qualified. Examples: "boolean" "int" "long[]" "java.lang.String"
  "java.util.Date" "java.util.Collection<java.lang.Integer>" "java.util.Map<java.lang.String, com.durr.FooPair<java.lang.Integer,
  java.util.Date>>" "com.durr.FooNonGenericClass" "com.durr.FooGenericClass<java.lang.String, java.lang.Integer>"
  "com.durr.FooGenericClass<int[], com.durr.FooGenericClass<com.durr.FooNonGenericClass, java.lang.Boolean>>".
  @return String converted and encoded value
  @throws UnsupportedEncodingException DOCUMENT_ME