Skip to main content

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

Project description


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.


pip install rejd

Or you can install it from GitHub:

pip install -e 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]


Just run pytest to run unit tests.

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


Apache License 2.0 (See LICENSE)

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

rejd-0.0.1.tar.gz (8.0 kB view hashes)

Uploaded source

Built Distribution

rejd-0.0.1-py3-none-any.whl (8.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page