json.append: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
m (Conversion script moved page json.append to Json.append without leaving a redirect: Converting page title to first-letter uppercase)
(No difference)

Revision as of 22:22, 9 February 2023

json.append() Function

Introduced in version 1.3b49
Appends values to the end of a JSON Array. An empty string ("") can be used to represent an empty JSON Array to append the values to.

Usage

[h: jarr = json.append(jarr, value, ...)]

Example

Create a JSON array from a string list and then append an additional value.
[h:a=json.fromList("a,1,g,4")]
[r: json.append(a, 55)]

Returns

["a",1,"g",4,55]

Create a JSON array directly with append.

[r: json.append("", 1, 5, 8, 33)]

Returns

[1,5,8,33]