Skip to main content

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

Project details


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hopy-0.0.2-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

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

Hashes for hopy-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0ef4f53e84abfecaa5bb8c3d7dfcaa2c4136b7021af87f08b8b8fe145b9ae201
MD5 7a92bfb5474efe82e9561ed498412b95
BLAKE2b-256 20724b680ccfd61a21ca607de9cf9792920d593a171fb52f4c67f7346a850b8e

See more details on using hashes here.

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

Hashes for hopy-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0cebcdad9128155763ee6157e27355a36230788fceb69255192eb80cca49bd19
MD5 3e45f047ebfc7aef9f00ee4ab3e738b6
BLAKE2b-256 06ad2e4e31100be6479e094a07123acd6c34e20aa9f344a2b0204176532521ac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page