json.difference: Difference between revisions
Jump to navigation
Jump to search
(Tweaking page layout and typography, fixed usage duplication) |
No edit summary |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{stub|Examples of usage | {{stub|Examples of usage.}} | ||
{{MacroFunction | {{MacroFunction | ||
|name=json.difference | |name=json.difference | ||
|version=1.3b53 | |version=1.3b53 | ||
|description= | |description= | ||
Returns an array with the differences of all of the [[JSON Object]] keys, or [[JSON Array]] values. | Returns an array with the differences of all of the [[JSON Object]] keys, or [[JSON Array]] values. Output contains keys or values which exist in the first parameter, but do not exist in any others. | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
json.difference(array, array, ...) | json.difference(array, array, ...) | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
json.difference(object, object, ...) | json.difference(object, object, ...) | ||
</ | </syntaxhighlight> | ||
'''Parameter''' | '''Parameter''' | ||
{{param|array|A [[JSON Array]] to get the difference of.}} | {{param|array|A [[JSON Array]] to get the difference of.}} | ||
Line 18: | Line 18: | ||
|example= | |example= | ||
So per example: | So per example: | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[json.difference(array2, array1)] | [json.difference(array2, array1)] | ||
</ | </syntaxhighlight> | ||
will result in {{code|array2}} from which all elements that are found in {{code|array1}} are removed. | will result in {{code|array2}} from which all elements that are found in {{code|array1}} are removed. | ||
|also= | |also= | ||
{{func|json.union}}, | {{func|json.union}}, | ||
{{func|json.merge}} | {{func|json.merge}}, | ||
{{func|json.intersection}} | |||
}} | }} | ||
[[Category:JSON Function]] | [[Category:JSON Function]] |
Latest revision as of 18:45, 15 March 2023
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.
json.difference() Function
• Introduced in version 1.3b53
Returns an array with the differences of all of the JSON Object keys, or JSON Array values. Output contains keys or values which exist in the first parameter, but do not exist in any others.
Usage
json.difference(array, array, ...)
json.difference(object, object, ...)
Parameter
array
- A JSON Array to get the difference of.object
- A JSON Object to get the difference of.
Example
So per example:
will result in
[json.difference(array2, array1)]
array2
from which all elements that are found in array1
are removed.