A high level language for predicate evaluation on JSON using JsonPath expressions
Project description
hopy
A high level language for predicate evaluation on JSON using JsonPath expressions
Getting started
Prerequisites
- python3.7+
Installation
- Install the package using pip.
pip install hopy[jsonpath_ng]
Usage
from hopy.evaluator import HopyEvaluator
rule_payload = {
"str": "Hello World!",
"num": 1337,
"float": 13.37,
"nested": {
"str": "Hello again!"
}
}
rule = '`$.str` == "Hello World!" && (`$.num` == 1337 || `$.float` < 13) && f.in(f.lower(`$.nested.str`), "hello")'
rule_evaluator = HopyEvaluator(rule)
rule_evaluator.evaluate(rule_payload) # True
License
This project is licensed under the Apache License - see the LICENSE.md file for details
Acknowledgements
- Inspired from santanusinha/hope
- Default JsonPath implementation jsonpath-ng
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
hopy-0.0.2.tar.gz
(5.6 kB
view details)
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
hopy-0.0.2-py3-none-any.whl
(10.4 kB
view details)
File details
Details for the file hopy-0.0.2.tar.gz.
File metadata
- Download URL: hopy-0.0.2.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ef4f53e84abfecaa5bb8c3d7dfcaa2c4136b7021af87f08b8b8fe145b9ae201
|
|
| MD5 |
7a92bfb5474efe82e9561ed498412b95
|
|
| BLAKE2b-256 |
20724b680ccfd61a21ca607de9cf9792920d593a171fb52f4c67f7346a850b8e
|
File details
Details for the file hopy-0.0.2-py3-none-any.whl.
File metadata
- Download URL: hopy-0.0.2-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cebcdad9128155763ee6157e27355a36230788fceb69255192eb80cca49bd19
|
|
| MD5 |
3e45f047ebfc7aef9f00ee4ab3e738b6
|
|
| BLAKE2b-256 |
06ad2e4e31100be6479e094a07123acd6c34e20aa9f344a2b0204176532521ac
|