This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Class

JSONArray

Name

setJSONArray()

Examples
JSONArray json;

void setup() {

  json = new JSONArray();

  for (int i = 0; i < 3; i++) {

    JSONArray values = new JSONArray();

    values.setInt(0, i);
    values.setInt(1, i);
    values.setInt(2, i);

    json.setJSONArray(i, values);
  }  

  println(json);
}

// Sketch prints:
//[
//  [
//    0,
//    0,
//    0
//  ],
//  [
//    1,
//    1,
//    1
//  ],
//  [
//    2,
//    2,
//    2
//  ]
//]
Description Sets the value of the JSONArray with the associated index value.
Syntax
.setJSONArray(index, value)
Parameters
index int: the index value to target
value JSONArray: the value to assign
ReturnsJSONArray
RelatedsetJSONObject()
getJSONObject()
getJSONArray()
Updated on October 2, 2018 05:02:12pm EDT

Creative Commons License