- Processing
- p5.js
- Processing.py
- Processing for Android
- Processing for Pi

- Processing Foundation

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 | ### append()
Examples |
    JSONArray json;

    void setup() {

      json = new JSONArray();

      json.append(32);
      json.append(1.5);
      json.append("grape");
      json.append(true);

      JSONObject obj = new JSONObject();
      obj.setFloat("persistence", 0.75);
      json.append(obj);

      JSONArray arr = new JSONArray();
      arr.append("red");
      arr.append("green");
      arr.append("blue");
      json.append(arr);

      println(json);
    }

    // Sketch prints:
    // [
    //   32,
    //   1.5,
    //   "grape",
    //   true,
    //   {"persistence": 0.75},
    //   [
    //     "red",
    //     "green",
    //     "blue"
    //   ]
    // ]
Description | Appends a new value to the JSONArray, increasing the array's length by one. New values may be of the following types: int, float, String, boolean, JSONObject, or JSONArray.
Syntax |
    .append(value)
Parameters |
value | String: a String value
value | int: an int value
value | float: a float value
value | boolean: a boolean value
value | JSONArray: a JSONArray value
value | JSONObject: a JSONObject value
Returns | JSONArray
Related | size() remove()

Updated on January 1, 2021 03:38:09am EST
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.