- 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.

Name | ### loadJSONObject()
Examples |
    // The following short JSON file called "data.json" is parsed
    // in the code below. It must be in the project's "data" folder.

    /*
      {
        "id": 0,
        "species": "Panthera leo",
       "name": "Lion"
      }
    */

    JSONObject json;

    void setup() {

      json = loadJSONObject("data.json");

      int id = json.getInt("id");
      String species = json.getString("species");
      String name = json.getString("name");

      println(id + ", " + species + ", " + name);
    }

    // Sketch prints:
    // 0, Panthera leo, Lion
Description | Loads a JSON from the data folder or a URL, and returns a JSONObject. All files loaded and saved by the Processing API use UTF-8 encoding.
Syntax |
    loadJSONObject(filename)
Parameters |
filename | String: name of a file in the data folder or a URL
Returns | JSONObject
Related | JSONObject JSONArray loadJSONArray() saveJSONObject() saveJSONArray()

Updated on January 9, 2020 00:33:09pm EST