code: protected JSONAware toJSON(Object pValue) {
          Class givenClass = pValue.getClass();
          if (JSONAware.class.isAssignableFrom(givenClass)) {
              return (JSONAware) pValue;
          } else {
              try {
                  return (JSONAware) new JSONParser().parse(pValue.toString());
              } catch (ParseException e) {
                  throw new IllegalArgumentException("Cannot parse JSON " + pValue + ": " + e,e);
              } catch (ClassCastException exp) {
                  throw new IllegalArgumentException("Given value " + pValue.toString() +
                                                     " cannot be parsed to JSONAware object: " + exp,exp);
              }
          }
      }
docs: Convert to JSON. The given object must be either a valid JSON string or of type {@link JSONAware}, in which
  case it is returned directly
  
  @param pValue the value to parse (or to return directly if it is a {@link JSONAware}
  @return the resulting value