DeeplyNested
The aim of the library is to make working with Deeply nested json structures more fun.
from src import NestedObject
sample_dict = { "k1":"v1", "k2":[{"a1":"v2","a2":"v3"},{"a1":"v4","a2":"v5"}]}
d2 = NestedObject(sample_dict)
d2.data
print(d2.paths)
# List of all available paths ['/k1', '/k2', '/k2[0]', '/k2[0]/a1', '/k2[0]/a2', '/k2[1]', '/k2[1]/a1', '/k2[1]/a2']
print(d2.keys()) # List of keys Similar to .keys method in dict ['/k1', '/k2', '/k2[0]', '/k2[0]/a1', '/k2[0]/a2', '/k2[1]', '/k2[1]/a1', '/k2[1]/a2']
print(d2.items())
# list of tuples Similar to the items method in a normal dictionary
# [('/k1', 'v1'), ('/k2', [{'a1': 'v2', 'a2': 'v3'}, {'a1': 'v4', 'a2': 'v5'}]), ('/k2[0]', {'a1': 'v2', 'a2': 'v3'}), ('/k2[0]/a1', 'v2'), ('/k2[0]/a2', 'v3'), ('/k2[1]', {'a1': 'v4', 'a2': 'v5'}), ('/k2[1]/a1', 'v4'), ('/k2[1]/a2', 'v5')]
print(d2.get(keypath='/k2'))
# Tuple with (key, value) where key is the keypath
# ('/k2', [{'a1': 'v2', 'a2': 'v3'}, {'a1': 'v4', 'a2': 'v5'}])
print(d2.get(keypath='/k2[i]/a1'))
# List of tuple with i replaced with length of list in k2 key
# [('/k2[0]', {'a1': 'v2', 'a2': 'v3'}), ('/k2[1]', {'a1': 'v4', 'a2': 'v5'})]
Please feel free to raise an issue. This is under active maintainence.
Metadata
Release files for deeply-nested 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| deeply-nested-0.0.2.tar.gz | 3.7 kB | Without provenance | Details for deeply-nested-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| deeply_nested-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for deeply_nested-0.0.2-py3-none-any.whl |
Total release size: 7.9 kB
Release files / deeply-nested-0.0.2.tar.gz
| Download URL | deeply-nested-0.0.2.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
943114d43fc51a219baf17113080c67af551253fecc915d7ff767b996988199d
|
|
BLAKE2b-256 checksum How to use checksums |
7ba7018982a84bd0c49de76b2083c39011b2c5746faaac9308bf851a17eab738
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
|
Release files / deeply_nested-0.0.2-py3-none-any.whl
| Download URL | deeply_nested-0.0.2-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0fb6553d2db87012c751f11cb81845a2a73fa623f1331f37c585aca2afe4d74e
|
|
BLAKE2b-256 checksum How to use checksums |
124d25c02523ba329ef88cc859644dfe158872ca9ffaae386381f48005d2bc12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
|
Security for deeply-nested 0.0.2
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.