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.

Syntax

JSON_REMOVE_ITEM (JSON, JSONPath)

Parameters

  • JSON
    A string that will be interpreted as JSON document. If it is not a JSON document, a runtime error will be thrown.

  • JSONPath
    A JSONPath to the item that should be removed. The JSONPath can only target one item.

Return value

  • 0
    JSON_REMOVE_ITEM terminated without errors

Runtime errors

The function will fail with a runtime error on the following conditions:

  • 45334
    Invalid JSON document
  • 45342
    Syntax Error in JSONPath expression
  • 45339
    JSONPath matches more than one element
  • 45340
    JSONPath does not match any element
  • 45348
    Cannot remove root element of a JSON document

Tip: To remove multiple elements at once, use this function in combination with JSON_TO_PROCESS.

See also: