Load nested JSON files into a dictionary
Project description
pyModularJSON
Allows recursive loading of JSON files featuring comments. Now uses json5 so it is a bit less picky on line terminations
Authored by Edwin Peters
Install
pip install pyLoadModularJson
or
setup.py install
Usage
Also check tests folder for a few examples
base.json:
// comments
{
"param2a": 2,
"nestedParam2a":{
"a": "notaNumber",
"c": "set by base"
}
}
main.json:
// comments
{
"configBase": ["base.json"], // parent config file name relative to this file
"param1": 4,
"nestedParam1":{
"a":39,
"b":["peee","e","new"],
"c": "set by main"
}
}
In Python:
from pyLoadModularJson import loadModularJson
cfg = loadModularJson('base.json')
print(cfg)
Child files will overwrite attributes from base files.
See more examples in tests
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file pyLoadModularJson-0.9.1.tar.gz
.
File metadata
- Download URL: pyLoadModularJson-0.9.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5456483896548b1816db73188023d4663d3922e80b253d2619738e2e6d67fb1 |
|
MD5 | ecbc6ca9b546aa083c313b63f8470eaa |
|
BLAKE2b-256 | cacbb446edf213408db628eb0ca09112d8fb4d85af1b489129aa81d22ab4f99a |
File details
Details for the file pyLoadModularJson-0.9.1-py3-none-any.whl
.
File metadata
- Download URL: pyLoadModularJson-0.9.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 939ae4574bbd7d6a1421634e10f23ffffeeb10a380f53f9e93a3ea3a5746226c |
|
MD5 | 4346c8bd05e3575293423dacdd2adef9 |
|
BLAKE2b-256 | ed72a1c115a15cb9e6e0da15ee7c00297508aa7be7880ca777d86ae6d25c2dc2 |