JSON Remove Node

Overview

You can use this filter to remove a JSON node from a JSON message. You can specify the node to remove using a JSON Path expression. The JSON Path query language enables you to select nodes in a JSON document.

For more details on JSON Path, see http://code.google.com/p/jsonpath.

Configuration

To configure this filter, specify the following fields:

Name:

Enter a suitable name that reflects the role of the filter.

JSON Path Expression:

Enter a JSON Path expression to specify the node to remove (for example, $.store.bicycle). The Policy Studio prompts if you enter an unsupported JSON Path expression.

[Note] Note

If the specified expression returns more than one node, all returned nodes are removed.

Fail if no nodes returned from JSON Path:

When this option is selected, and the JSON Path expression returns no nodes, the filter returns false. If this option is not selected, and the JSON Path returns no nodes, the filter returns true, and no nodes are removed. This option is not selected by default.

Save deleted nodes to be reinserted to new location:

Select this option if you want to move JSON nodes from one location in the message to another. The deleted nodes are stored in the deleted.json.node.list message attribute. You can then use the JSON Add Node filter to insert the deleted nodes into a different location in the message. For more details, see the topic on JSON Add Node.

Examples

The following are some examples of using the JSON Remove Node filter.

Removing a Node

The following example shows removing a bicycle from the store:

Adding a JSON Node

The following example shows the corresponding request and response message in Oracle API Gateway Explorer:

Added JSON Node

Removing all Items in an Array

The following example shows removing all books in an array:

Remove JSON Array

The following example shows the corresponding request and response message in Oracle API Gateway Explorer:

Removed JSON Array