Skip to content

Commit 7867d6a

Browse files
committed
More notable differences.
1 parent 73ee0f8 commit 7867d6a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/syntax.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ This is a list of things that you might find in other JSONPath implementation th
199199
- We do not support arithmetic in filter expression.
200200
- We don't allow dotted array indices. An array index must be surrounded by square brackets.
201201
- Python JSONPath is strictly read only. There are no update "selectors", but we do provide methods for converting `JSONPathMatch` instances to `JSONPointer`s, and a `JSONPatch` builder API for modifying JSON-like data structures using said pointers.
202-
- We don't attempt to handle JSON documents without a top-level array or object (or equivalent Python objects).
203202

204203
And this is a list of areas where we deviate from [RFC 9535](https://datatracker.ietf.org/doc/html/rfc9535).
205204

@@ -209,15 +208,18 @@ And this is a list of areas where we deviate from [RFC 9535](https://datatracker
209208
- We don't require the recursive descent segment to have a selector. `$..` is equivalent to `$..*`.
210209
- We support explicit comparisons to `undefined` as well as implicit existence tests.
211210
- Float literals without a fractional digit are OK. `1.` is equivalent to `1.0`.
212-
- We treat literals (such as `true` and `false`) as valid "basic" expressions. So `$[?true || false]` does not raise a syntax error, which is and invalid query according to RFC 9535.
211+
- We treat literals (such as `true` and `false`) as valid "basic" expressions. For example, `$[?true || false]`, without an existence test or comparison either side of logical _or_, does not raise a syntax error.
212+
- By default, `and` is equivalent to `&&` and `or` is equivalent to `||`.
213+
- `none` and `nil` are aliases for `null`.
214+
- `null` (and its aliases), `true` and `false` can start with an upper or lower case letter.
213215

214216
And this is a list of features that are uncommon or unique to Python JSONPath.
215217

216218
- We support membership operators `in` and `contains`, plus list/array literals.
217219
- `|` 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.
218220
- `&` 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.
219221
- `#` is the current key/property or index identifier when filtering a mapping or sequence.
220-
- `_` is a filter context selector. With usage similar to `$` and `@`, `_` exposes arbitrary data from the `filter_context` argument to `findall()` and `finditer()`.
222+
- `_` is a filter context identifier. With usage similar to `$` and `@`, `_` exposes arbitrary data from the `filter_context` argument to `findall()` and `finditer()`.
221223
- `~` is a "keys" or "properties" selector.
222224
- `^` is a "fake root" identifier. It is equivalent to `$`, but wraps the target JSON document in a single-element array, so the root value can be conditionally selected with a filter selector.
223225
- `=~` is the the regex match operator, matching a value to a JavaScript-style regex literal.

0 commit comments

Comments
 (0)