json.append: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
(Applied Template:MacroFunction)
Line 1: Line 1:
==Function json.append==
{{MacroFunction
 
|name=json.append
 
|version=1.3b49
 
|description=
'''Introduced in MapTool 1.3b49'''
Appends values to the end of a [[Macros:json array|json array]]. An empty string ("") can be used to represent an empty [[Macros:json array|json array]] to append the values to.
Appends values to the end of a [[Macros:json array|json array]]. An empty string ("") can be used to represent an empty [[Macros:json array|json array]] to append the values to.


===Usage===
|usage=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: jarr = json.append(jarr, value, ...)]
[h: jarr = json.append(jarr, value, ...)]
</source>
</source>


 
|example=
===Examples===
<source lang="mtmacro" line>
<source lang="mtmacro" line>
   [h:a=json.fromList("a,1,g,4")][r: json.append(a, 55)]
   [h:a=json.fromList("a,1,g,4")][r: json.append(a, 55)]
Line 21: Line 19:
   ["a",1,"g",4,55]
   ["a",1,"g",4,55]
   [1,5,8,33]
   [1,5,8,33]
}}
[[Category:JSON Function]]

Revision as of 01:59, 9 March 2009

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

  [h:a=json.fromList("a,1,g,4")][r: json.append(a, 55)]
  [r: json.append("", 1, 5, 8, 33)]

Returns

  ["a",1,"g",4,55]
[1,5,8,33]