RFC 9535 JSONPath: Query Expressions for JSON in Python
We follow RFC 9535 strictly and test against the JSONPath Compliance Test Suite.
Table of Contents
Install
Install Python JSONPath RFC 9535 using pip:
python -m pip install jsonpath-rfc9535
Or uv:
uv add jsonpath-rfc9535
Or Pipenv:
pipenv install -u jsonpath-rfc9535
Links
- Documentation: https://jg-rp.github.io/python-jsonpath-rfc9535/
- Change log: https://github.com/jg-rp/python-jsonpath-rfc9535/blob/main/CHANGELOG.md
- PyPi: https://pypi.org/project/jsonpath-rfc9535
- Source code: https://github.com/jg-rp/python-jsonpath-rfc9535
- Issue tracker: https://github.com/jg-rp/python-jsonpath-rfc9535/issues
Example
import jsonpath_rfc9535 as jsonpath
expr = "$.users[?@.status == 'pending'].name"
data: dict[str, object] = {
"users": [
{"id": "usr_101", "name": "Alice", "status": "pending"},
{"id": "usr_102", "name": "Bob", "status": "active"},
{"id": "usr_103", "name": "Charlie", "status": "pending"},
],
}
nodes = jsonpath.find(expr, data)
print(nodes.values()) # ['Alice', 'Charlie']
print(nodes.locations()) # [('users', 0, 'name'), ('users', 2, 'name')]
print(nodes.paths()) # ["$['users'][0]['name']", "$['users'][2]['name']"]
Related projects
- Python JSONPath - Another Python package implementing JSONPath, but with additional features and customization options.
- JSON P3 - RFC 9535 implemented in TypeScript.
License
python-jsonpath-rfc9535 is distributed under the terms of the MIT license.
Metadata
Release files for jsonpath-rfc9535 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jsonpath_rfc9535-2.0.1.tar.gz | 146.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jsonpath_rfc9535-2.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 179.0 kB
Release files / jsonpath_rfc9535-2.0.1.tar.gz
| Download URL | jsonpath_rfc9535-2.0.1.tar.gz |
|---|---|
| Size | 146.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cf6d0c5c9eea07bd3b9bca98ab7f8a461fafe06e3cde5aafc7a7621afeb24bc7
|
|
BLAKE2b-256 checksum How to use checksums |
10fdc4f328f7f224cc8a152269af233f602b3cca14a987d04690b29859fa1cf2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / jsonpath_rfc9535-2.0.1-py3-none-any.whl
| Download URL | jsonpath_rfc9535-2.0.1-py3-none-any.whl |
|---|---|
| Size | 32.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fe00a8bf7d6f1091213f0dff33569acd1c7dddc54d57845941c74923598bd1b9
|
|
BLAKE2b-256 checksum How to use checksums |
56591ccb3174e4a09be353783928a19a23cbfabc5a835065ed4c21108b54ec44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|