code: static String valueToString(Object value, int indentFactor, int indent)
              throws JSONException {
          if (value == null || value.equals(null)) {
              return "null";
          }
          if (value instanceof Number) {
              return numberToString((Number) value);
          }
          if (value instanceof Date) {
              return dateToString((Date) value);
          }
          if (value instanceof Boolean) {
              return value.toString();
          }
          if (value instanceof JSONObject) {
              return ((JSONObject) value).toString(indentFactor, indent);
          }
          if (value instanceof JSONArray) {
              return ((JSONArray) value).toString(indentFactor, indent);
          }
          return quote(value.toString());
      }
docs: Make a prettyprinted JSON text of an object value.
  <p/>
  Warning: This method assumes that the data structure is acyclical.
  
  @param value        The value to be serialized.
  @param indentFactor The number of spaces to add to each level of
  indentation.
  @param indent       The indentation of the top level.
  @return a printable, displayable, transmittable
  representation of the object, beginning
  with <code>{</code>&nbsp;<small>(left brace)</small> and ending
  with <code>}</code>&nbsp;<small>(right brace)</small>.
  @throws JSONException If the object contains an invalid number.