| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| README.md | 2026-10-23 | 4.1 kB | |
| v1.13.0 source code.tar.gz | 2026-10-23 | 159.5 kB | |
| v1.13.0 source code.zip | 2026-10-23 | 199.9 kB | |
| Totals: 3 Items | 363.5 kB | 0 | |
Added
-
Support the RFC 9535 logical operators
&&and||in filters. (#27)For example,
parse("$[?@.a == 1 || @.b == 2 && @.c == 3]").Note that filters are currently only supported in the
jsonpath_ng.extmodule.&&binds more tightly than||, and parentheses group expressions. The operators are valid only inside a filter.
Fixed
- Fix
Slice.filter()taking quadratic time to remove array elements. - Fix
Slice.filter()removing the wrong elements from an array. -
Return
[]when a slice's step size is0.For example,
parse("$[::0]").find([1,2,3])now returns[].This aligns with RFC 9535, section 2.3.4.2.2.
-
Fix
!=filter comparisons with literals.This includes fixing comparisons between string and integer values, as well as fixing comparisons when the target path doesn't exist.
For example,
parse("$[?@.a != 1]").find([{"b": 1}])finds{"b": 1}. Previously,{"b": 1}was excluded because it didn't have an"a"field.For example,
parse("$[?@.a != 1]").find([{"a": "x"}])finds{"a": "x"}. Previously,{"a": "x"}was excluded.This change aligns with RFC 9535, section 2.3.5.2.2.
-
Fix a
TypeErrorthat occurs when a filter orders values of different types.For example,
parse("$[?@.a < 1]").find([{"a": None}])now finds nothing instead of raising aTypeError. -
Stop speculatively coercing strings to integers in filter comparisons.
For example,
parse("$[?@.a == 1]").find([{"a": " +0_1"}])now finds nothing. Previously, the string" +0_1"was converted to an integer before comparing and would incorrectly match.Note that this also means that simpler numeric strings will no longer match. For example,
parse("$[?@.a == 1]").find([{"a": "1"}])now finds nothing. -
Serialize filters so that they can be parsed again.
Note that
thisin a filter selector is now replaced with@, which is the RFC 9535 compliant syntax.Similarly, strings are single-quoted and
&is replaced with&&as is required by RFC 9535.For example,
str(parse("$[?`this`.a == 1 & @.b == x]"))now returns$[?@.a == 1 && @.b == 'x']. -
Quote field names that begin with
@when serializing a query, unless the@is followed by a letter or an underscore.For example,
str(jsonpath_ng.ext.parse("$['@']"))now returns$.'@'. Previously it returned$.@, whichjsonpath_ng.extparsed as the current node.
Deprecated
-
The
|(union) operator between paths is deprecated.A
DeprecationWarningis issued when the operator is used. It will be removed in version 2.0.0.There is no RFC 9535 equivalent.
A now-deprecated path like
($.a) | ($.b)can be replaced with code like this:python matches = parse("$.a").find(data) + parse("$.b").find(data)Beware that
|binds tighter than.. Unparenthesized paths likea.b | c.dare interpreted asa.(b | c).d, so write each full path when migrating and test the paths and results for equivalency. -
The
&(intersection) operator between paths is deprecated.A
DeprecationWarningis issued when the&(intersection) operator is used. It will be removed in version 2.0.0.There is no RFC 9535 equivalent.
-
The
&(logical AND) operator in filters is deprecated.A
DeprecationWarningis issued when the&(logical AND) operator is used. It will be removed in version 2.0.0.Its RFC 9535 equivalent is
&&. Use&&instead of&in filters. -
The
UnionandIntersectclasses are deprecated.A
DeprecationWarningis issued when they are accessed. They will be removed in version 2.0.0.
Documentation
- Update the README.