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.2
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.2.tar.gz | 146.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jsonpath_rfc9535-2.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 179.1 kB
Release files / jsonpath_rfc9535-2.0.2.tar.gz
| Download URL | jsonpath_rfc9535-2.0.2.tar.gz |
|---|---|
| Size | 146.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07e5ba16067905b5e8c0ff3a49184908f6e90f8cde473638f9f387b4f24d4e00
|
|
BLAKE2b-256 checksum How to use checksums |
1d0c4a274cfb022464458be05a5029388a85c10536de2524ee49b3b01806d4ad
|
| 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.2-py3-none-any.whl
| Download URL | jsonpath_rfc9535-2.0.2-py3-none-any.whl |
|---|---|
| Size | 32.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a8fd8054619bef2cac7ad04fc3a686ad8a3c552aa9a40f246bd7acef75ac779c
|
|
BLAKE2b-256 checksum How to use checksums |
e8fa3d124fe4cc1f48190555df4288e83a004977bd4adaa333b40abad479587a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|