Tabnine Logo
JSONArray.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
us.monoid.json.JSONArray
constructor

Best Java code snippets using us.monoid.json.JSONArray.<init> (Showing top 20 results out of 315)

origin: beders/Resty

/**
 * Put a value in the JSONArray, where the value will be a JSONArray which is
 * produced from a Collection.
 * 
 * @param value
 *          A Collection value.
 * @return this.
 */
public JSONArray put(Collection<?> value) {
  put(new JSONArray(value));
  return this;
}
origin: us.monoid.web/resty

/**
 * Put a value in the JSONArray, where the value will be a JSONArray which is
 * produced from a Collection.
 * 
 * @param value
 *          A Collection value.
 * @return this.
 */
public JSONArray put(Collection<?> value) {
  put(new JSONArray(value));
  return this;
}
origin: beders/Resty

/**
 * Put a key/value pair in the JSONObject, where the value will be a JSONArray
 * which is produced from a Collection.
 * 
 * @param key
 *          A key string.
 * @param value
 *          A Collection value.
 * @return this.
 * @throws JSONException
 */
public JSONObject put(String key, Collection<?> value) throws JSONException {
  put(key, new JSONArray(value));
  return this;
}

origin: us.monoid.web/resty

/**
 * Put a key/value pair in the JSONObject, where the value will be a JSONArray
 * which is produced from a Collection.
 * 
 * @param key
 *          A key string.
 * @param value
 *          A Collection value.
 * @return this.
 * @throws JSONException
 */
public JSONObject put(String key, Collection<?> value) throws JSONException {
  put(key, new JSONArray(value));
  return this;
}

origin: us.monoid.web/resty

/**
 * Put a value in the JSONArray, where the value will be a JSONArray which is
 * produced from a Collection.
 * 
 * @param index
 *          The subscript.
 * @param value
 *          A Collection value.
 * @return this.
 * @throws JSONException
 *           If the index is negative or if the value is not finite.
 */
public JSONArray put(int index, Collection<?> value) throws JSONException {
  put(index, new JSONArray(value));
  return this;
}
origin: beders/Resty

/**
 * Put a value in the JSONArray, where the value will be a JSONArray which is
 * produced from a Collection.
 * 
 * @param index
 *          The subscript.
 * @param value
 *          A Collection value.
 * @return this.
 * @throws JSONException
 *           If the index is negative or if the value is not finite.
 */
public JSONArray put(int index, Collection<?> value) throws JSONException {
  put(index, new JSONArray(value));
  return this;
}
origin: beders/Resty

return new JSONArray((Collection<?>) object);
return new JSONArray(object);
origin: us.monoid.web/resty

/**
 * Produce a JSONArray containing the names of the elements of this
 * JSONObject.
 * 
 * @return A JSONArray containing the key strings, or null if the JSONObject
 *         is empty.
 */
public JSONArray names() {
  JSONArray ja = new JSONArray();
  Iterator<String> keys = keys();
  while (keys.hasNext()) {
    ja.put(keys.next());
  }
  return ja.length() == 0 ? null : ja;
}
origin: beders/Resty

/**
 * Produce a JSONArray containing the names of the elements of this
 * JSONObject.
 * 
 * @return A JSONArray containing the key strings, or null if the JSONObject
 *         is empty.
 */
public JSONArray names() {
  JSONArray ja = new JSONArray();
  Iterator<String> keys = keys();
  while (keys.hasNext()) {
    ja.put(keys.next());
  }
  return ja.length() == 0 ? null : ja;
}
origin: beders/Resty

case '(':
  back();
  return new JSONArray(this);
origin: us.monoid.web/resty

/**
 * Accumulate values under a key. It is similar to the put method except that
 * if there is already an object stored under the key then a JSONArray is
 * stored under the key to hold all of the accumulated values. If there is
 * already a JSONArray, then the new value is appended to it. In contrast, the
 * put method replaces the previous value.
 * 
 * @param key
 *          A key string.
 * @param value
 *          An object to be accumulated under the key.
 * @return this.
 * @throws JSONException
 *           If the value is an invalid number or if the key is null.
 */
public JSONObject accumulate(String key, Object value) throws JSONException {
  testValidity(value);
  Object o = opt(key);
  if (o == null) {
    put(key, value instanceof JSONArray ? new JSONArray().put(value) : value);
  } else if (o instanceof JSONArray) {
    ((JSONArray) o).put(value);
  } else {
    put(key, new JSONArray().put(o).put(value));
  }
  return this;
}
origin: beders/Resty

/**
 * Produce a JSONArray of JSONObjects from a comma delimited text string
 * using a supplied JSONArray as the source of element names.
 * @param names A JSONArray of strings.
 * @param x A JSONTokener of the source text.
 * @return A JSONArray of JSONObjects.
 * @throws JSONException
 */
public static JSONArray toJSONArray(JSONArray names, JSONTokener x)
    throws JSONException {
  if (names == null || names.length() == 0) {
    return null;
  }
  JSONArray ja = new JSONArray();
  for (;;) {
    JSONObject jo = rowToJSONObject(names, x);
    if (jo == null) {
      break;
    }
    ja.put(jo);
  }
  if (ja.length() == 0) {
    return null;
  }
  return ja;
}
origin: us.monoid.web/resty

/**
 * Produce a JSONArray of JSONObjects from a comma delimited text string
 * using a supplied JSONArray as the source of element names.
 * @param names A JSONArray of strings.
 * @param x A JSONTokener of the source text.
 * @return A JSONArray of JSONObjects.
 * @throws JSONException
 */
public static JSONArray toJSONArray(JSONArray names, JSONTokener x)
    throws JSONException {
  if (names == null || names.length() == 0) {
    return null;
  }
  JSONArray ja = new JSONArray();
  for (;;) {
    JSONObject jo = rowToJSONObject(names, x);
    if (jo == null) {
      break;
    }
    ja.put(jo);
  }
  if (ja.length() == 0) {
    return null;
  }
  return ja;
}
origin: beders/Resty

/**
 * Accumulate values under a key. It is similar to the put method except that
 * if there is already an object stored under the key then a JSONArray is
 * stored under the key to hold all of the accumulated values. If there is
 * already a JSONArray, then the new value is appended to it. In contrast, the
 * put method replaces the previous value.
 * 
 * @param key
 *          A key string.
 * @param value
 *          An object to be accumulated under the key.
 * @return this.
 * @throws JSONException
 *           If the value is an invalid number or if the key is null.
 */
public JSONObject accumulate(String key, Object value) throws JSONException {
  testValidity(value);
  Object o = opt(key);
  if (o == null) {
    put(key, value instanceof JSONArray ? new JSONArray().put(value) : value);
  } else if (o instanceof JSONArray) {
    ((JSONArray) o).put(value);
  } else {
    put(key, new JSONArray().put(o).put(value));
  }
  return this;
}
origin: beders/Resty

/**
 * Produce a JSONArray containing the values of the members of this
 * JSONObject.
 * 
 * @param names
 *          A JSONArray containing a list of key strings. This determines the
 *          sequence of the values in the result.
 * @return A JSONArray of values.
 * @throws JSONException
 *           If any of the values are non-finite numbers.
 */
public JSONArray toJSONArray(JSONArray names) throws JSONException {
  if (names == null || names.length() == 0) {
    return null;
  }
  JSONArray ja = new JSONArray();
  for (int i = 0; i < names.length(); i += 1) {
    ja.put(this.opt(names.getString(i)));
  }
  return ja;
}
origin: us.monoid.web/resty

/**
 * Produce a JSONArray containing the values of the members of this
 * JSONObject.
 * 
 * @param names
 *          A JSONArray containing a list of key strings. This determines the
 *          sequence of the values in the result.
 * @return A JSONArray of values.
 * @throws JSONException
 *           If any of the values are non-finite numbers.
 */
public JSONArray toJSONArray(JSONArray names) throws JSONException {
  if (names == null || names.length() == 0) {
    return null;
  }
  JSONArray ja = new JSONArray();
  for (int i = 0; i < names.length(); i += 1) {
    ja.put(this.opt(names.getString(i)));
  }
  return ja;
}
origin: beders/Resty

JSONArray ja = new JSONArray();
for (;;) {
  String value = getValue(x);
origin: us.monoid.web/resty

JSONArray ja = new JSONArray();
for (;;) {
  String value = getValue(x);
origin: beders/Resty

/**
 * 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 key string.
 * @param value
 *          An object to be accumulated under the key.
 * @return this.
 * @throws JSONException
 *           If the key is null or if the current value associated with the
 *           key is not a JSONArray.
 */
public JSONObject append(String key, Object value) throws JSONException {
  testValidity(value);
  Object o = opt(key);
  if (o == null) {
    put(key, new JSONArray().put(value));
  } else if (o instanceof JSONArray) {
    put(key, ((JSONArray) o).put(value));
  } else {
    throw new JSONException("JSONObject[" + key + "] is not a JSONArray.");
  }
  return this;
}
origin: us.monoid.web/resty

/**
 * 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 key string.
 * @param value
 *          An object to be accumulated under the key.
 * @return this.
 * @throws JSONException
 *           If the key is null or if the current value associated with the
 *           key is not a JSONArray.
 */
public JSONObject append(String key, Object value) throws JSONException {
  testValidity(value);
  Object o = opt(key);
  if (o == null) {
    put(key, new JSONArray().put(value));
  } else if (o instanceof JSONArray) {
    put(key, ((JSONArray) o).put(value));
  } else {
    throw new JSONException("JSONObject[" + key + "] is not a JSONArray.");
  }
  return this;
}
us.monoid.jsonJSONArray<init>

Javadoc

Construct an empty JSONArray.

Popular methods of JSONArray

  • length
    Get the number of elements in the JSONArray, included nulls.
  • get
    Get the object value associated with an index.
  • getJSONObject
    Get the JSONObject associated with an index.
  • getString
    Get the string associated with an index.
  • toString
    Make a prettyprinted JSON text of this JSONArray. Warning: This method assumes that the data structu
  • getBoolean
    Get the boolean value associated with an index. The string values "true" and "false" are converted t
  • getDouble
    Get the double value associated with an index.
  • getInt
    Get the int value associated with an index.
  • getLong
    Get the long value associated with an index.
  • join
    Make a string from the contents of this JSONArray. Theseparator string is inserted between each elem
  • opt
    Get the optional object value associated with an index.
  • optBoolean
    Get the optional boolean value associated with an index. It returns the defaultValue if there is no
  • opt,
  • optBoolean,
  • optDouble,
  • optInt,
  • optJSONObject,
  • optLong,
  • optString,
  • put,
  • toJSONObject

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSystemService (Context)
  • findViewById (Activity)
  • onCreateOptionsMenu (Activity)
  • Kernel (java.awt.image)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Permission (java.security)
    Legacy security code; do not use.
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • JFileChooser (javax.swing)
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now