Overview
A lightweight JSONPath engine is supported within the json-prune, json-override, replace-xhr-response, and replace-xhr-request snippets. This allows for precise targeting of properties within JSON objects using standard path notation.
To use JSONPath in a filter, prefix the path argument with jsonpath(. If the prefix is omitted, the snippet falls back to its standard behaviour.
Supported Syntax
|
Operator |
Name |
Description |
Example |
|---|---|---|---|
|
|
Root |
Represents the root object of the JSON structure. |
|
|
|
Dot Access |
Accesses a child property by name. |
|
|
|
Recursive descent |
Searches for a key at any level of the hierarchy.
|
|
|
|
Wildcard |
Matches all child properties or array elements. |
|
|
|
Bracket notation |
Used for keys with special characters, indexes, or filter expressions. |
|
|
|
Filter expression |
Filters objects based on a property comparison. |
|
Filter Comparison Operators
Within a [?()] expression, the following comparison operators are supported:
-
Equality / Inequality:
==,!= -
Numeric / Lexical:
<,<=,>,>= -
String matching:
^=(starts with),$=(ends with),*=(contains)
Examples
|
Filter |
Result |
|---|---|
|
|
Removes every instance of |
|
|
Overrides the |
|
|
Removes all properties within the |
|
|
Removes every instance of |
|
|
Sets |