json.union: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
(Added a further explaination for what a union is, and added an example.)
Line 4: Line 4:
|version=1.3b53
|version=1.3b53
|description=
|description=
Returns an [[JSON Array]] with the union of all of the [[JSON Object]] keys, or [[JSON Array]] values.
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 not be placed in the output object or array.


|usage=
|usage=
Line 16: Line 16:
{{param|array|The [[JSON Array]]s to union.}}
{{param|array|The [[JSON Array]]s to union.}}
{{param|object|The [[JSON Object]]s to union.}}
{{param|object|The [[JSON Object]]s to union.}}
|examples=
<source lang="mtmacro" line>
  [h: array1 = json.append("",1,2,3,4)]
  [h: array2 = json.append("",3,4,5,6)]
  [r: json.union(array1,array2)]
</source>
Returns
"[1,2,3,4,5,6]"


|also=
|also=

Revision as of 07:54, 10 July 2013

 This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
 This article needs: Examples of usage, clearer description.

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 not be placed 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