- 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 | ### getString()
Examples |
    // The following short JSON file called "data.json" is parsed
    // in the code below. It must be in the project's "data" folder.
    //
    // [ 32, 1.13, "grape", true ]

    JSONArray json;

    void setup() {

      json = loadJSONArray("data.json");

      int count = json.getInt(0);
      float weight = json.getFloat(1);
      String name = json.getString(2);
      boolean isFruit = json.getBoolean(3);

      println(count + ", " + weight + ", " + name + ", " + isFruit);
    }

    // Sketch prints:
    // 32, 1.13, grape, true
Description | Gets the String value associated with the specified index.
Syntax |
    .getString(index)
    .getString(index, defaultValue)
Parameters |
index | int: must be between 0 and length() - 1
index | int: The index must be between 0 and length() - 1.
defaultValue | String: The default value.
Returns | String
Related | getInt() getFloat() getBoolean()

Updated on July 4, 2018 11:56:45am EDT