Extract from a JSON/dict only whats in the JSON Schema
Project description
Extract from a JSON/dict only whats in the JSON Schema. Assumes that the JSON/dict you supply is valid according to the JSON Schema you also supply.
Installation
pip install json-schema-reducer
How to use it
Suppose you have two files on disk: schema.json and mything.json. And suppose that the schema.json only lists the properties foo and bar but the file mything.json contains many more things:
>>> from json_schema_reducer import make_reduced_dict >>> make_reduced_dict('schema.json', 'mything.json') {'foo': 'value1', 'bar': 'value2'}
The arguments are flexible. You can also do this:
>>> make_reduced_dict(open('schema.json'), open('mything.json'))
Or this:
>>> make_reduced_dict(open('schema.json').read(), open('mything.json').read())
Or this:
>>> make_reduced_dict( ... json.load(open('schema.json')), ... json.load(open('mything.json')))
Runnings tests
Simply run:
python setup.py test
Version History
- 0.1.2
Correct README restructured text
- 0.1.1
Tidying up loose ends
- 0.1.0
First, hopefully, working version.
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
Built Distribution
Close
Hashes for json-schema-reducer-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e64d6754390ae129513a27af811f657bc104cfdd9e5e300902a1a5b57f83ebd4 |
|
MD5 | 1db061619f9ee3e859b9d8afcbd11b2e |
|
BLAKE2b-256 | 5354a903f1f1eaf2c14aa21f7ef2c978ff8fe06892cd63b5e3d1fca055cb529e |
Close
Hashes for json_schema_reducer-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07b38c2f9bf57274096f45ed7d8726390431f3b048b28a92a3fc92532bf86b0e |
|
MD5 | 22dbed72a838c148ac3e792d074e4d64 |
|
BLAKE2b-256 | 52129ce67e0f6569880ac0a0b61c6582537fd7bf175bbe9ee219c1d8662220c7 |