MCPcopy Create free account
hub / github.com/MCBans/MCBans / append

Method append

src/main/java/com/mcbans/plugin/org/json/JSONObject.java:398–410  ·  view source on GitHub ↗

Append values to the array under a key. If the key does not exist in the JSONObject, then the key is put in the JSONObject with its value being a JSONArray containing the value parameter. If the key was already associated with a JSONArray, then the value parameter is appended to it. @param key A k

(String key, Object value)

Source from the content-addressed store, hash-verified

396 * associated with the key is not a JSONArray.
397 */
398 public JSONObject append(String key, Object value) throws JSONException {
399 testValidity(value);
400 Object object = opt(key);
401 if (object == null) {
402 put(key, new JSONArray().put(value));
403 } else if (object instanceof JSONArray) {
404 put(key, ((JSONArray)object).put(value));
405 } else {
406 throw new JSONException("JSONObject[" + key +
407 "] is not a JSONArray.");
408 }
409 return this;
410 }
411
412
413 /**

Callers 15

request_from_apiMethod · 0.45
escapeMethod · 0.45
toStringMethod · 0.45
unescapeMethod · 0.45
nextStringMethod · 0.45
nextToMethod · 0.45
nextValueMethod · 0.45
nextTokenMethod · 0.45
toStringMethod · 0.45
toStringMethod · 0.45
nextCDATAMethod · 0.45
nextContentMethod · 0.45

Calls 3

testValidityMethod · 0.95
optMethod · 0.95
putMethod · 0.95

Tested by

no test coverage detected