JSON_REMOVE_ITEM
Use the JSON_REMOVE_ITEM script function to remove JSON object keys or array elements. The JSON document is modified in place.
Tip: To remove multiple elements at once, use this function in combination with JSON_TO_PROCESS.
Syntax
JSON_REMOVE_ITEM (JSON, JSONPath)
Parameters
| Parameter | Description |
|---|---|
| JSON | A string interpreted as a JSON document. If it is not a valid JSON document, a runtime error occurs. |
| JSONPath | A JSONPath to the item to remove. The JSONPath can target only one item. |
Return Codes
| Return Value | Condition |
|---|---|
| 0 | The function completed without errors |
The function causes a runtime error in the following cases:
| Runtime Error Code | Condition |
|---|---|
| 45334 | Invalid JSON document |
| 45342 | Syntax error in the JSONPath expression |
| 45339 | The JSONPath matches more than one element |
| 45340 | The JSONPath does not match any element |
| 45348 | Cannot remove the root element of a JSON document |
See also:
seealso