json.union: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Conversion script moved page json.union to Json.union without leaving a redirect: Converting page title to first-letter uppercase)
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 6: Line 6:


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
json.union(array, array, ...)
json.union(array, array, ...)
</source>
</syntaxhighlight>
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
json.union(object, object, ...)
json.union(object, object, ...)
</source>
</syntaxhighlight>
'''Parameters'''
'''Parameters'''
{{param|array|The [[JSON Array]]s to union.}}
{{param|array|The [[JSON Array]]s to union.}}
Line 17: Line 17:


|examples=
|examples=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
   [h: array1 = json.append("",1,2,3,4)]
   [h: array1 = json.append("",1,2,3,4)]
   [h: array2 = json.append("",3,4,5,6)]
   [h: array2 = json.append("",3,4,5,6)]
   [r: json.union(array1,array2)]
   [r: json.union(array1,array2)]
</source>
</syntaxhighlight>


Returns
Returns

Latest revision as of 23:59, 15 March 2023

json.union() Function

Introduced in version 1.3b53
Returns an JSON Array with the union of all of the JSON Object keys, or JSON Array values. If a value or a key occurs in multiple different objects or arrays, it will only be placed once in the output object or array.

Usage

json.union(array, array, ...)
json.union(object, object, ...)

Parameters

Examples

  [h: array1 = json.append("",1,2,3,4)]
  [h: array2 = json.append("",3,4,5,6)]
  [r: json.union(array1,array2)]

Returns

"[1,2,3,4,5,6]"

See Also