json.remove: Difference between revisions
Jump to navigation
Jump to search
m (Conversion script moved page Json.remove to json.remove: Converting page titles to lowercase) |
No edit summary |
||
Line 6: | Line 6: | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: jarr = json.remove(jarr, index)] | [h: jarr = json.remove(jarr, index)] | ||
[h: jarr = json.remove(jobj, key)] | [h: jarr = json.remove(jobj, key)] | ||
</ | </syntaxhighlight> | ||
|examples= | |examples= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h:a=json.fromStrProp("a=1;b=44;c=12")] [r:json.remove(a, "c")] | [h:a=json.fromStrProp("a=1;b=44;c=12")] [r:json.remove(a, "c")] | ||
[h:a=json.fromList("a,1,g,4")][r:json.remove(a,3)] | [h:a=json.fromList("a,1,g,4")][r:json.remove(a,3)] | ||
</ | </syntaxhighlight> | ||
Returns | Returns |
Revision as of 16:39, 15 March 2023
json.remove() Function
• Introduced in version 1.3b49
Removes a field from a JSON Object, or the value at the specified index from a JSON Array. If the field is not present in the JSON Object, it is returned unchanged. If the index does not exist in a JSON Array, a java.lang.IndexOutOfBoundsException is raised.
Usage
[h: jarr = json.remove(jarr, index)]
[h: jarr = json.remove(jobj, key)]
Examples
[h:a=json.fromStrProp("a=1;b=44;c=12")] [r:json.remove(a, "c")]
[h:a=json.fromList("a,1,g,4")][r:json.remove(a,3)]
Returns
{"a":1,"b":44}["a",1,"g"]