# What changed in python-jsonpath

> 32 changes in python-jsonpath 1 to 2 from its official release notes, upgrade guides and advisories: 12 breaking, 13 new APIs and options. Each one cited. Sources checked 2026-11-15. HTML: https://unstale.sh/pypi/python-jsonpath/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## python-jsonpath 2

### Breaking changes

- Copy targets now use add semantics, allowing the special - index to append and raising JSONPatchError when the target index exceeds the array length. (2.2.2) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.2.2)
- Move targets now use add semantics, allowing the special - index to append and raising JSONPatchError when the target index exceeds the array length. (2.2.2) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.2.2)
- Move operations with immutable Mapping or Sequence source objects now raise JSONPatchError instead of silently behaving as copies. (2.2.2) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.2.2)
- Unquoted property names in brackets are now singular query selectors rather than quoted names. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)
- Whitespace is no longer allowed between `.` or `..` and the following name. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)
- Float literals must follow RFC syntax; `.1` and `1.` are invalid. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)
- Tokens produced by the lexer changed, affecting projects that customize the JSONPath lexer or parser. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)
- The simple Python function implementation was replaced by the `Keys` class. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)
- The class variable was renamed to `JSONPathEnvironment.pseudo_root_token`. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)
- Renames the `fake_root_token` class variable to `pseudo_root_token`. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)
- Indexes and steps reject leading zeros and negative zero with JSONPathSyntaxError. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)

### New APIs and options

- Added a non-mutating form of JSONPatch application that deep-copies the input data and returns the patched copy. (2.2.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.2.0)
- Adds an atomic patch operation that preserves input data if a patch operation fails. (2.1.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.1.0)
- The non-standard `keys()` function extension is now implemented as a well-typed class instead of a simple Python function. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)
- The constructor now accepts `cache_capacity`. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)
- The constructor now accepts `debug`. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)
- The constructor now accepts `thread_safe`. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)
- Adds a class variable to control the maximum recursion depth of descendant segments. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)
- Adds the Keys filter selector. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)
- Adds the Singular query selector. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)
- Adds a function extension that returns True when both arguments are strings and prefix is a prefix of value. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)
- Adds a `strict` argument to convenience functions and the JSONPathEnvironment constructor, and to the CLI; when true, non-standard extensions and relaxed parsing rules are disabled. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)

### Behavior and default changes

- Exception messages are improved to be prettier and more informative. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)
- Match and search function extensions use the `regex` package instead of `re` when it is installed. (2.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.0)

### Fixes and other changes

- Parser recursion limit failures raise JSONPathRecursionError, preserving the original RecursionError as the cause; the error subclasses RecursionError so existing handlers continue working. (2.2.1) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.2.1)
- Fixed atomic JSONPatch application when a patch operation replaces the document root. (2.2.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.2.0)
- Fixed tokenization of quoted name selectors ending in an escaped backslash, allowing selectors and normalized paths for keys containing backslashes to be parsed correctly. (2.2.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.2.0)
- Parsing now handles non-standard JSONPath regular expression literals containing an escaped solidus when using the =~ operator. (2.0.2) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v2.0.2)

## python-jsonpath 1

### Breaking changes

- The undocumented keys function extension is no longer enabled by default; a new, well-typed keys function is planned for the future. (1.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v1.0.0)

### New APIs and options

- Non-standard environment-controlled tokens can be disabled by setting them to the empty string. (1.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v1.0.0)
- 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. (1.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v1.0.0)

### Fixes and other changes

- Environment-controlled tokens are sorted by length in descending order, allowing one custom token to be a prefix of another. (1.0.0) — [release notes](https://github.com/jg-rp/python-jsonpath/releases/tag/v1.0.0)
