pypi / python-jsonpath
python-jsonpath
What changed in python-jsonpath 1 to 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-15.
12 breaking13 new APIs and options2 behavior and defaults5 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initpython-jsonpath 228 changes
Breaking changes 11
Copy targets now use add semantics, allowing the special - index to append and raising JSONPatchError when the target index exceeds the array length.
Move targets now use add semantics, allowing the special - index to append and raising JSONPatchError when the target index exceeds the array length.
Move operations with immutable Mapping or Sequence source objects now raise JSONPatchError instead of silently behaving as copies.
Unquoted property names in brackets are now singular query selectors rather than quoted names.
Whitespace is no longer allowed between
.or..and the following name.Float literals must follow RFC syntax;
.1and1.are invalid.Tokens produced by the lexer changed, affecting projects that customize the JSONPath lexer or parser.
The simple Python function implementation was replaced by the
Keysclass.The class variable was renamed to
JSONPathEnvironment.pseudo_root_token.Renames the
fake_root_tokenclass variable topseudo_root_token.Indexes and steps reject leading zeros and negative zero with JSONPathSyntaxError.
New APIs and options 11
Added a non-mutating form of JSONPatch application that deep-copies the input data and returns the patched copy.
Adds an atomic patch operation that preserves input data if a patch operation fails.
The non-standard
keys()function extension is now implemented as a well-typed class instead of a simple Python function.The constructor now accepts
cache_capacity.The constructor now accepts
debug.The constructor now accepts
thread_safe.Adds a class variable to control the maximum recursion depth of descendant segments.
Adds the Keys filter selector.
Adds the Singular query selector.
Adds a function extension that returns True when both arguments are strings and prefix is a prefix of value.
Adds a
strictargument to convenience functions and the JSONPathEnvironment constructor, and to the CLI; when true, non-standard extensions and relaxed parsing rules are disabled.
Behavior and default changes 2
Exception messages are improved to be prettier and more informative.
Match and search function extensions use the
regexpackage instead ofrewhen it is installed.
Fixes and other changes 4
Parser recursion limit failures raise JSONPathRecursionError, preserving the original RecursionError as the cause; the error subclasses RecursionError so existing handlers continue working.
Fixed atomic JSONPatch application when a patch operation replaces the document root.
Fixed tokenization of quoted name selectors ending in an escaped backslash, allowing selectors and normalized paths for keys containing backslashes to be parsed correctly.
Parsing now handles non-standard JSONPath regular expression literals containing an escaped solidus when using the =~ operator.
python-jsonpath 14 changes
Breaking changes 1
The undocumented keys function extension is no longer enabled by default; a new, well-typed keys function is planned for the future.
New APIs and options 2
Non-standard environment-controlled tokens can be disabled by setting them to the empty string.
Adds a non-standard identifier, defaulting to ^ and customizable with fake_root_token on a JSONPathEnvironment subclass; it wraps the target JSON value in an array so the root value can be conditionally selected using a filter.
Fixes and other changes 1
Environment-controlled tokens are sorted by length in descending order, allowing one custom token to be a prefix of another.