Reference+
Name
getBoolean()
Class
JSONObject
Description
Gets the boolean value associated with the specified key.
Examples
// The following short JSON file called "data.json" is parsed // in the code below. It must be in the project's "data" folder. // // { // "count": 32, // "weight": 1.13, // "name": "grape", // "isFruit": true // } JSONObject json; void setup() { json = loadJSONObject("data.json"); int count = json.getInt("count"); float weight = json.getFloat("weight"); String name = json.getString("name"); boolean isFruit = json.getBoolean("isFruit"); println(count + ", " + weight + ", " + name + ", " + isFruit); } // Sketch prints: // 32, 1.13, grape, true
Syntax
.getBoolean(key)
.getBoolean(key, defaultValue)
Parameters
key
(String)
a key stringkey
(String)
A key string.defaultValue
(boolean)
The default.
Return
boolean
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.