Reference+
Name
setJSONObject()
Class
JSONArray
Description
Sets the value of the JSONObject with the index value.
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" // } // ]
Syntax
- .setJSONObject(index, value)
Parameters
- index- (int)the index value to target
- value- (JSONObject)the value to assign
Return
- JSONArray

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.