forked from processing/processing-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSONArray_append.xml
More file actions
executable file
·59 lines (45 loc) · 1 KB
/
JSONArray_append.xml
File metadata and controls
executable file
·59 lines (45 loc) · 1 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>append()</name>
<category>JSONArray</category>
<subcategory>Method</subcategory>
<type>method</type>
<example>
<image></image>
<code><![CDATA[
JSONArray json;
void setup() {
json = new JSONArray();
json.append(32);
json.append(1.5);
json.append("grape");
json.append(true);
JSONObject obj = new JSONObject();
obj.setFloat("persistence", 0.75);
json.append(obj);
JSONArray arr = new JSONArray();
arr.append("red");
arr.append("green");
arr.append("blue");
json.append(arr);
println(json);
}
// Sketch prints:
// [
// 32,
// 1.5,
// "grape",
// true,
// {"persistence": 0.75},
// [
// "red",
// "green",
// "blue"
// ]
// ]
]]></code>
</example>
<description><![CDATA[
Appends a new value to the <b>JSONArray</b>, increasing the array's length by one. New values may be of the following types: int, float, String, boolean, <b>JSONObject</b>, or <b>JSONArray</b>.
]]></description>
</root>