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
Simple install with pip:
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.4
Universal wheel
- 0.1.3
Better, but basic, cli (e.g. --help)
Support for optional nested keys
- 0.1.2
Correct README restructured text
- 0.1.1
Tidying up loose ends
- 0.1.0
First, hopefully, working version.
Release files for json-schema-reducer 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| json-schema-reducer-0.1.4.tar.gz | 2.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| json_schema_reducer-0.1.4-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 7.0 kB
Release files / json-schema-reducer-0.1.4.tar.gz
| Download URL | json-schema-reducer-0.1.4.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b6fbe437361e0ec14f5c05daf752604834bd9abe5af9ab6bdcb05ea1f8df1df6
|
|
BLAKE2b-256 checksum How to use checksums |
28f61e2cc23d6379879b96c601fe3d0992585af37cc60cbd17de9ba4dc73d616
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / json_schema_reducer-0.1.4-py2.py3-none-any.whl
| Download URL | json_schema_reducer-0.1.4-py2.py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
41c674275c2650dadb7f8af1193640ca41eb863926985ecda5bfee93aef265c0
|
|
BLAKE2b-256 checksum How to use checksums |
511a5ac1131dcffa1063a0e0ded04e1326ea5a98dcc76d763b3532ecb7c73cfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |