You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,14 @@
4
4
5
5
**Breaking changes**
6
6
7
-
- The "extra context" identifier now defaults to `_`. Previously it defaulted to `#`, but it has been decided that `#` is better suited as a "keys" or "properties" identifier.
7
+
- The "extra filter context" identifier now defaults to `_`. Previously it defaulted to `#`, but it has been decided that `#` is better suited as a current key/property or index identifier.
8
8
9
9
**Features**
10
10
11
11
- Added a non-standard keys/properties selector (`~`).
12
12
- Added a non-standard `typeof()` filter function. `type()` is an alias for `typeof()`.
13
13
- Added a non-standard `isinstance()` filter function. `is()` is an alias for `isinstance()`.
14
+
- Added a current key/property or index identifier. When filtering a mapping, `#` will hold key associated with the current node (`@`). When filtering a sequence, `#` will hold the current index.
Copy file name to clipboardExpand all lines: docs/syntax.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -120,9 +120,9 @@ $..title
120
120
$...title
121
121
```
122
122
123
-
### Filters (`[?(EXPRESSION)]`)
123
+
### Filters (`[?EXPRESSION]`)
124
124
125
-
Filters allow you to remove nodes from a selection using a Boolean expression. Within a filter, `@` refers to the current node and `$` refers to the root node in the target document. `@` and `$` can be used to select nodes as part of the expression. Since version 0.3.0, the parentheses are optional, as per the IETF JSONPath draft. These two examples are equivalent.
125
+
Filters allow you to remove nodes from a selection using a Boolean expression. When filtering a mapping-like object, `#` references the current key/property and `@` references the current value associated with `#`. When filtering a sequence-like object, `@` references the current item and `#` will hold the item's index in the sequence.
126
126
127
127
```text
128
128
$..products[?(@.price < $.price_cap)]
@@ -187,5 +187,6 @@ And this is a list of features that are uncommon or unique to Python JSONPath.
187
187
188
188
-`|` is a union operator, where matches from two or more JSONPaths are combined. This is not part of the Python API, but built-in to the JSONPath syntax.
189
189
-`&` is an intersection operator, where we exclude matches that don't exist in both left and right paths. This is not part of the Python API, but built-in to the JSONPath syntax.
190
+
-`#` is the current key/property or index identifier when filtering a mapping or sequence.
190
191
-`_` is a filter context selector. With usage similar to `$` and `@`, `_` exposes arbitrary data from the `filter_context` argument to `findall()` and `finditer()`.
0 commit comments