Library for matching large numbers of JSONPath expressions simultaniously
Project description
JSON Hyperscan
A small, fast library that builds a simple "hyperscan" automaton to match many JSONPath (RFC9535-style) expressions against JSON documents. The project provides a compact in-process matcher that aims for parity with jsonpath_rfc9535.
Key features
- Add many JSONPath selectors and build a matching automaton
- Query JSON documents for matches efficiently
- Support for field, child, descendant, index, slice and filter selectors
- Small, well-tested core implementation located at
src/json_hyperscan/json_hyperscan.py
Quick start
Install (developer/test environment)
This project uses modern Python tooling. Create a virtual environment and install dev dependencies listed in pyproject.toml.
python -m venv .venv
source .venv/bin/activate
pip install -U pip
# Recommended (fast, reproducible): install uv and use it to manage deps
pip install uv
# Create a venv and install project + dev deps using uv's pip frontend
uv pip install -e .[dev]
Note about the compliance test-suite
The project includes the JSONPath compliance tests as a git submodule at tests/jsonpath-compliance-test-suite.
CI checks out submodules automatically, but if you're running tests locally you may need to initialize it first:
git submodule update --init --recursive
Or, if you only need runtime installation (no dev extras):
pip install -e .
Basic usage
A minimal example using the public API in JSONHyperscan:
from json_hyperscan import JSONHyperscan
hs = JSONHyperscan()
hs.add_pattern('$.store.book[*].author')
hs.add_pattern('$..title')
doc = {
"store": {
"book": [
{"author": "Nigel Rees", "title": "Sayings of the Century"},
{"author": "Evelyn Waugh", "title": "Sword of Honour"}
]
}
}
matches = list(hs.iter_matches(doc))
for m in matches:
print(m)
License
See the LICENSE file in the repository.
Acknowledgements
This project uses jsonpath_rfc9535 for parsing and some tests compare output to other JSONPath implementations. See pyproject.toml for the dependency list used in development and testing.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file json_hyperscan-0.1.0.tar.gz.
File metadata
- Download URL: json_hyperscan-0.1.0.tar.gz
- Upload date:
- Size: 70.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06f17155d31f9b0c4430c7082d60d6550d18aa62b83b7ef96cbeced28ec41b20
|
|
| MD5 |
62f59384752e6de08e6869317dc01e57
|
|
| BLAKE2b-256 |
56088358cf0e54e59b2ff082c6be874bf7d8b5f6a1a5beda032b8e180b1e844b
|
Provenance
The following attestation bundles were made for json_hyperscan-0.1.0.tar.gz:
Publisher:
publish.yml on captonsnake/json_hyperscan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
json_hyperscan-0.1.0.tar.gz -
Subject digest:
06f17155d31f9b0c4430c7082d60d6550d18aa62b83b7ef96cbeced28ec41b20 - Sigstore transparency entry: 685359538
- Sigstore integration time:
-
Permalink:
captonsnake/json_hyperscan@7e18eb34182089d5723f10e80ebfaf302b3ff93e -
Branch / Tag:
refs/tags/v.0.1.1 - Owner: https://github.com/captonsnake
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7e18eb34182089d5723f10e80ebfaf302b3ff93e -
Trigger Event:
push
-
Statement type:
File details
Details for the file json_hyperscan-0.1.0-py3-none-any.whl.
File metadata
- Download URL: json_hyperscan-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
742c4d9604dd6138d2f02b7841cc0a5be5af0f9966e10a7ba798876083471aef
|
|
| MD5 |
6794f0488ac6cd1a500ead110f06fcdd
|
|
| BLAKE2b-256 |
51a27566818f176d18d1cf59b2cc7810570c14bc9b0c332364a343b0f4eec0e5
|
Provenance
The following attestation bundles were made for json_hyperscan-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on captonsnake/json_hyperscan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
json_hyperscan-0.1.0-py3-none-any.whl -
Subject digest:
742c4d9604dd6138d2f02b7841cc0a5be5af0f9966e10a7ba798876083471aef - Sigstore transparency entry: 685359571
- Sigstore integration time:
-
Permalink:
captonsnake/json_hyperscan@7e18eb34182089d5723f10e80ebfaf302b3ff93e -
Branch / Tag:
refs/tags/v.0.1.1 - Owner: https://github.com/captonsnake
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7e18eb34182089d5723f10e80ebfaf302b3ff93e -
Trigger Event:
push
-
Statement type: