/** * Append an object value.<p> * * @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)); }
/** * Append an object value.<p> * * @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 append(JSONObject.valueToString(o)); }
/** * Make a string from the contents of this JSONArray.<p> * * The <code>separator</code> string is inserted between each element.<p> * * Warning: This method assumes that the data structure is acyclical.<p> * * @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 = length(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < len; i += 1) { if (i > 0) { sb.append(separator); } sb.append(JSONObject.valueToString(m_myArrayList.get(i))); } return sb.toString(); }
/** * Make a string from the contents of this JSONArray.<p> * * The <code>separator</code> string is inserted between each element.<p> * * Warning: This method assumes that the data structure is acyclical.<p> * * @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 = length(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < len; i += 1) { if (i > 0) { sb.append(separator); } sb.append(JSONObject.valueToString(this.m_myArrayList.get(i))); } return sb.toString(); }
StringBuffer sb = new StringBuffer("["); if (len == 1) { sb.append(JSONObject.valueToString(this.m_myArrayList.get(0), indentFactor, indent)); } else { int newindent = indent + indentFactor; sb.append(' '); sb.append(JSONObject.valueToString(this.m_myArrayList.get(i), indentFactor, newindent));
StringBuffer sb = new StringBuffer("["); if (len == 1) { sb.append(JSONObject.valueToString(m_myArrayList.get(0), indentFactor, indent)); } else { int newindent = indent + indentFactor; sb.append(' '); sb.append(JSONObject.valueToString(m_myArrayList.get(i), indentFactor, newindent));
sb.append(quote(o.toString())); sb.append(':'); sb.append(valueToString(m_map.get(o)));
sb.append(quote(o.toString())); sb.append(':'); sb.append(valueToString(this.m_map.get(o)));
sb.append(quote(key)); sb.append(": "); sb.append(valueToString(m_map.get(key), indentFactor, indent)); } else { while (keys.hasNext()) { sb.append(valueToString(m_map.get(key), indentFactor, newindent));
sb.append(quote(o.toString())); sb.append(": "); sb.append(valueToString(this.m_map.get(o), indentFactor, indent)); } else { while (keys.hasNext()) { sb.append(valueToString(this.m_map.get(o), indentFactor, newindent));
((JSONArray)v).write(writer); } else { writer.write(valueToString(v));
((JSONArray)v).write(writer); } else { writer.write(valueToString(v));
((JSONArray)v).write(writer); } else { writer.write(JSONObject.valueToString(v));
((JSONArray)v).write(writer); } else { writer.write(JSONObject.valueToString(v));