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 | JSONObject |
||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Examples | JSONObject json; void setup() { json = new JSONObject(); json.setInt("id", 0); json.setString("species", "Panthera leo"); json.setString("name", "Lion"); saveJSONObject(json, "data/new.json"); } // Sketch saves the following to a file called "new.json": // { // "id": 0, // "species": "Panthera leo", // "name": "Lion" // } | ||||||||||||||||||||||||||
Description |
A JSONObject stores JSON data with multiple name/value pairs. Values can be numeric, Strings, booleans, other JSONObjects or JSONArrays, or null. JSONObject and JSONArray objects are quite similar and share most of the same methods; the primary difference is that the latter stores an array of JSON objects, while the former represents a single JSON object. JSON can be generated from scratch, dynamically, or using data from an existing file. JSON can also be output and saved to disk, as in the example above. |
||||||||||||||||||||||||||
Methods |
| ||||||||||||||||||||||||||
Related | JSONArray loadJSONObject() loadJSONArray() saveJSONObject() saveJSONArray() |
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.