- 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 | ### getIntArray()
Examples |
    // The following short JSON file called "data.json" is parsed
    // in the code below. It must be in the project's "data" folder.
    //
    // [ 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144 ]

    JSONArray json;

    void setup() {

      json = loadJSONArray("data.json");

      int[] values = json.getIntArray();

      println(values);
    }

    // Sketch prints:
    // [0] 0
    // [1] 1
    // [2] 1
    // [3] 2
    // [4] 3
    // [5] 5
    // [6] 8
    // [7] 13
    // [8] 21
    // [9] 34
    // [10] 55
    // [11] 89
    // [12] 144
Description | Returns the entire JSONArray as an array of ints. (All values in the array must be of the int type.)
Syntax |
    .getIntArray()
Returns | int[]
Related | getStringArray()

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