-
-
Notifications
You must be signed in to change notification settings - Fork 173
Expand file tree
/
Copy pathJSONArray_getInt.xml
More file actions
executable file
·43 lines (30 loc) · 832 Bytes
/
JSONArray_getInt.xml
File metadata and controls
executable file
·43 lines (30 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>getInt()</name>
<category>JSONArray</category>
<subcategory>Method</subcategory>
<type>method</type>
<example>
<image></image>
<code><![CDATA[
// 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
]]></code>
</example>
<description><![CDATA[
Gets the int value associated with the specified index.
]]></description>
</root>