Skip to main content
https://travis-ci.org/huntflow/json-processor.svg?branch=master https://codecov.io/gh/huntflow/json-processor/branch/master/graph/badge.svg

Simply convert one JSON to another.

  • Easy to use. Create a simple JSON conversion schema and pass it to processor

  • Rich. It uses jsonpointer so you can create complex processors

Example

from json_processor import json_process

schema = {
    "type": "object",
    "value": {
        "simple_key": "Just a string",
        "values": {
            "type": "array",
            "from": {
                "type": "jsonpointer",
                "value": "/data/items"
            },
            "value": {
                "type": "object",
                "value": {
                    "id": {
                        "type": "jsonpointer",
                        "value": "/$value/foreign",
                        "cast": "integer"
                    },
                    "name": {
                        "type": "jsonpointer",
                        "value": "/$value/name"
                    }
                }
            }
        }
    }
}

data = {
    "data": {
        "items": [
            {
                "foreign": "100",
                "name": "Item 1"
            },
            {
                "foreign": "150",
                "name": "Item 2"
            }
        ]
    }
}

print(json_process(schema, data))

# Outputs:
# {'simple_key': 'Just a string', 'values': [{'id': 100, 'name': 'Item 1'}, {'id': 150, 'name': 'Item 2'}]}

Installation

From PyPi

pip install json_processor

Command line tool

After installation you can use json_process utility:

json_process <schema_file> <json_file>

Metadata

Release files for json-processor 0.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for json-processor 0.0.10
File Size Uploaded Provenance Actions
json_processor-0.0.10.tar.gz 7.0 kB Without provenance Details for json_processor-0.0.10.tar.gz

Release files / json_processor-0.0.10.tar.gz

Download URL json_processor-0.0.10.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d28ff52e2c2b09fcf9a2682d84145da982232355c92826059e127b471b84bec6
BLAKE2b-256 checksum
How to use checksums
6c2234184661ccd45466478c8da65892dc210177695aeed01165fee86725cae7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.20.1 setuptools/36.2.7 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.2

Security for json-processor 0.0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page