Skip to content

ReJD (Representation JSON Data) - Library that change your "JSON like" data representation.

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE
Unknown
LICENSE.tpl
Notifications You must be signed in to change notification settings

rejd-tools/rejd-python

Repository files navigation

ReJD

ReJD (Representation JSON Data) - Python library that changes your "JSON-like" data representation.

The small library will help you pull data from an input object using JSONPath and generate new objects according to a schema.

JSONPath is like XPath (XML) for JSON. To learn the syntax, read the documentation for the original article.

Installation

pip install rejd

Or you can install it from GitHub:

pip install -e git+https://github.com/rejd-tools/rejd-python.git

Usage example

schema = { "source": "$", # root data (initial_data) "type": "object", "properties": { # fields schema for the new object "field1": { "source": "@.field1 * 2", # JSONPath "type": "float" }, "field2": { "source": "@.array", "type": "array", "items": { "source": "@.number" } } } } data = { "field1": 1.5, "array": [ {"number": 1}, {"number": 2} ] } assert transform(schema, data) == { "field1": 3.0, "field2": [1, 2] } 

Testing

Just run pytest to run unit tests.

Or you can use pre-commit to check and fix any issues: pre-commit run --all

License

Apache License 2.0 (See LICENSE)

About

ReJD (Representation JSON Data) - Library that change your "JSON like" data representation.

Topics

Resources

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE
Unknown
LICENSE.tpl

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages