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 | |||||
|---|---|---|---|---|---|
| Name | setJSONObject() | ||||
| Examples | 
JSONArray json;
void setup() {
  json = new JSONArray();
  JSONObject lion = new JSONObject();
  lion.setInt("id", 0);
  lion.setString("species", "Panthera leo");
  
  json.setJSONObject(0, lion);
  JSONObject zebra = new JSONObject();
  zebra.setInt("id", 1);
  zebra.setString("species", "Equus zebra");
  
  json.setJSONObject(1, zebra);
  println(json);
}
// Sketch prints:
// [
//   {
//     "id": 0,
//     "species": "Panthera leo"
//   },
//   {
//     "id": 1,
//     "species": "Equus zebra"
//   }
// ]
 | ||||
| Description | Sets the value of the JSONObject with the index value. | ||||
| Syntax | .setJSONObject(index, value) | ||||
| Parameters | 
 | ||||
| Returns | JSONArray | ||||
| Related | setJSONArray() getJSONObject() getJSONArray() | 
