org.json.JSONObject.valueToString()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(597)

本文整理了Java中org.json.JSONObject.valueToString()方法的一些代码示例,展示了JSONObject.valueToString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.valueToString()方法的具体详情如下:
包路径:org.json.JSONObject
类名称:JSONObject
方法名:valueToString

JSONObject.valueToString介绍

[英]Make a prettyprinted JSON text of an object value.

Warning: This method assumes that the data structure is acyclical.
[中]生成对象值的预打印JSON文本。
警告:此方法假定数据结构是非循环的。

代码示例

代码示例来源:origin: zzz40500/GsonFormat

/**
 * Make a string from the contents of this JSONArray. The
 * <code>separator</code> string is inserted between each element. Warning:
 * This method assumes that the data structure is acyclical.
 *
 * @param separator
 *            A string that will be inserted between the elements.
 * @return a string.
 * @throws JSONException
 *             If the array contains an invalid number.
 */
public String join(String separator) throws JSONException {
  int len = this.length();
  StringBuilder sb = new StringBuilder();
  for (int i = 0; i < len; i += 1) {
    if (i > 0) {
      sb.append(separator);
    }
    sb.append(JSONObject.valueToString(this.myArrayList.get(i)));
  }
  return sb.toString();
}

代码示例来源:origin: loklak/loklak_server

/**
 * Make a string from the contents of this JSONArray. The
 * <code>separator</code> string is inserted between each element. Warning:
 * This method assumes that the data structure is acyclical.
 *
 * @param separator
 *            A string that will be inserted between the elements.
 * @return a string.
 * @throws JSONException
 *             If the array contains an invalid number.
 */
public String join(String separator) throws JSONException {
  int len = this.length();
  StringBuilder sb = new StringBuilder();
  for (int i = 0; i < len; i += 1) {
    if (i > 0) {
      sb.append(separator);
    }
    sb.append(JSONObject.valueToString(this.myArrayList.get(i)));
  }
  return sb.toString();
}

代码示例来源:origin: b3log/latke

/**
 * Make a string from the contents of this JSONArray. The
 * <code>separator</code> string is inserted between each element. Warning:
 * This method assumes that the data structure is acyclical.
 *
 * @param separator
 *            A string that will be inserted between the elements.
 * @return a string.
 * @throws JSONException
 *             If the array contains an invalid number.
 */
public String join(String separator) throws JSONException {
  int len = this.length();
  if (len == 0) {
    return "";
  }
  
  StringBuilder sb = new StringBuilder(
        JSONObject.valueToString(this.myArrayList.get(0)));
  for (int i = 1; i < len; i++) {
    sb.append(separator)
     .append(JSONObject.valueToString(this.myArrayList.get(i)));
  }
  return sb.toString();
}

代码示例来源:origin: com.vaadin.external.json/json

/**
   * Append an object value.
   * @param o The object to append. It can be null, or a Boolean, Number,
   *   String, JSONObject, or JSONArray, or an object with a toJSONString()
   *   method.
   * @return this
   * @throws JSONException If the value is out of sequence.
   */
  public JSONWriter value(Object o) throws JSONException {
    return this.append(JSONObject.valueToString(o));
  }
}

代码示例来源:origin: io.snappydata/gemfire-json

/**
   * Append an object value.
   * @param object The object to append. It can be null, or a Boolean, Number,
   *   String, JSONObject, or JSONArray, or an object that implements JSONString.
   * @return this
   * @throws JSONException If the value is out of sequence.
   */
  public JSONWriter value(Object object) throws JSONException {
    return this.append(JSONObject.valueToString(object));
  }
}

代码示例来源:origin: jmaki/ajax-wrapper-comp

/**
   * Append an object value.
   * @param o The object to append. It can be null, or a Boolean, Number,
   *   String, JSONObject, or JSONArray, or an object with a toJSONString()
   *   method.
   * @return this
   * @throws JSONException If the value is out of sequence.
   */
  public JSONWriter value(Object o) throws JSONException {
    return this.append(JSONObject.valueToString(o));
  }
}

代码示例来源:origin: org.daisy.libs/com.xmlcalabash

/**
   * Append an object value.
   * @param o The object to append. It can be null, or a Boolean, Number,
   *   String, JSONObject, or JSONArray, or an object with a toJSONString()
   *   method.
   * @return this
   * @throws JSONException If the value is out of sequence.
   */
  public JSONWriter value(Object o) throws JSONException {
    return this.append(JSONObject.valueToString(o));
  }
}

代码示例来源:origin: quux00/hive-json-schema

/**
   * Append an object value.
   * @param object The object to append. It can be null, or a Boolean, Number,
   *   String, JSONObject, or JSONArray, or an object that implements JSONString.
   * @return this
   * @throws JSONException If the value is out of sequence.
   */
  public JSONWriter value(Object object) throws JSONException {
    return this.append(JSONObject.valueToString(object));
  }
}

代码示例来源:origin: org.json/com.springsource.org.json

/**
   * Append an object value.
   * @param o The object to append. It can be null, or a Boolean, Number,
   *   String, JSONObject, or JSONArray, or an object with a toJSONString()
   *   method.
   * @return this
   * @throws JSONException If the value is out of sequence.
   */
  public JSONWriter value(Object o) throws JSONException {
    return this.append(JSONObject.valueToString(o));
  }
}

代码示例来源:origin: com.unboundid.components/json

/**
   * Append an object value.
   * @param object The object to append. It can be null, or a Boolean, Number,
   *   String, JSONObject, or JSONArray, or an object that implements JSONString.
   * @return this
   * @throws JSONException If the value is out of sequence.
   */
  public JSONWriter value(Object object) throws JSONException {
    return this.append(JSONObject.valueToString(object));
  }
}

代码示例来源:origin: io.snappydata/gemfire-util

/**
   * Append an object value.
   * @param object The object to append. It can be null, or a Boolean, Number,
   *   String, JSONObject, or JSONArray, or an object that implements JSONString.
   * @return this
   * @throws JSONException If the value is out of sequence.
   */
  public JSONWriter value(Object object) throws JSONException {
    return this.append(JSONObject.valueToString(object));
  }
}

代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz

/**
   * Append an object value.
   * @param o The object to append. It can be null, or a Boolean, Number,
   *   String, JSONObject, or JSONArray, or an object with a toJSONString()
   *   method.
   * @return this
   * @throws JSONException If the value is out of sequence.
   */
  public JSONWriter value(Object o) throws JSONException {
    return this.append(JSONObject.valueToString(o));
  }
}

代码示例来源:origin: org.dynamicloud.api/dynamicloud

/**
   * Append an object value.
   * @param object The object to append. It can be null, or a Boolean, Number,
   *   String, JSONObject, or JSONArray, or an object that implements JSONString.
   * @return this
   * @throws JSONException If the value is out of sequence.
   */
  public JSONWriter value(Object object) throws JSONException {
    return this.append(JSONObject.valueToString(object));
  }
}

代码示例来源:origin: com.xmlcalabash/xmlcalabash

/**
   * Append an object value.
   * @param o The object to append. It can be null, or a Boolean, Number,
   *   String, JSONObject, or JSONArray, or an object with a toJSONString()
   *   method.
   * @return this
   * @throws JSONException If the value is out of sequence.
   */
  public JSONWriter value(Object o) throws JSONException {
    return this.append(JSONObject.valueToString(o));
  }
}

代码示例来源:origin: org.codeartisans/org.json

/**
   * Append an object value.
   * @param object The object to append. It can be null, or a Boolean, Number,
   *   String, JSONObject, or JSONArray, or an object that implements JSONString.
   * @return this
   * @throws JSONException If the value is out of sequence.
   */
  public JSONWriter value(Object object) throws JSONException {
    return this.append(JSONObject.valueToString(object));
  }
}

代码示例来源:origin: fernandospr/javapns-jdk16

/**
   * Append an object value.
   * @param o The object to append. It can be null, or a Boolean, Number,
   *   String, JSONObject, or JSONArray, or an object with a toJSONString()
   *   method.
   * @return this
   * @throws JSONException If the value is out of sequence.
   */
  public JSONWriter value(Object o) throws JSONException {
    return this.append(JSONObject.valueToString(o));
  }
}

代码示例来源:origin: org.apache.abdera/json

/**
   * Append an object value.
   * @param o The object to append. It can be null, or a Boolean, Number,
   *   String, JSONObject, or JSONArray, or an object with a toJSONString()
   *   method.
   * @return this
   * @throws JSONException If the value is out of sequence.
   */
  public JSONWriter value(Object o) throws JSONException {
    return this.append(JSONObject.valueToString(o));
  }
}

代码示例来源:origin: com.vaadin/vaadin-shared-deps

/**
   * Append an object value.
   * @param o The object to append. It can be null, or a Boolean, Number,
   *   String, JSONObject, or JSONArray, or an object with a toJSONString()
   *   method.
   * @return this
   * @throws JSONException If the value is out of sequence.
   */
  public JSONWriter value(Object o) throws JSONException {
    return this.append(JSONObject.valueToString(o));
  }
}

代码示例来源:origin: de.twentyeleven.skysail/org.json-osgi

/**
   * Append an object value.
   * @param o The object to append. It can be null, or a Boolean, Number,
   *   String, JSONObject, or JSONArray, or an object with a toJSONString()
   *   method.
   * @return this
   * @throws JSONException If the value is out of sequence.
   */
  public JSONWriter value(Object o) throws JSONException {
    return this.append(JSONObject.valueToString(o));
  }
}

代码示例来源:origin: org.datanucleus/datanucleus-api-json

/**
   * Append an object value.
   * @param o The object to append. It can be null, or a Boolean, Number,
   *   String, JSONObject, or JSONArray, or an object with a toJSONString()
   *   method.
   * @return this
   * @throws JSONException If the value is out of sequence.
   */
  public JSONWriter value(Object o) throws JSONException {
    return this.append(JSONObject.valueToString(o));
  }
}

相关文章

JSONObject类方法