Activejson
A convenient library to deal with large json data
A convenient library to deal with large json data. The purpose of this package is help to deal with complex json-like data, converting them into a more manageable data structure.
Installation
OS X & Linux:
From PYPI
$ pip3 install activejson
from the source
$ git clone https://github.com/dany2691/activejson.git
$ cd activejson
$ python3 setup.py install
Usage example
You can flat a complex dict the next way:
complex_json = {
'cat': {'grass': 'feline', 'mud': 'you never know', 'horse': 'my joke'},
'dolphin': [
{'tiger': [{'bird': 'blue jay'}, {'fish': 'dolphin'}]},
{'cat2': 'feline'},
{'dog2': 'canine'}
],
'dog': 'canine'
}
from activejson import flatten_json
flatten_complex_json = flatten_json(complex_json)
print(flatten_complex_json)
The result could be the next:
{
'cat_grass': 'feline',
'cat_horse': 'my joke',
'cat_mud': 'you never know',
'dog': 'canine',
'dolphin_0_tiger_0_bird': 'blue jay',
'dolphin_0_tiger_1_fish': 'dolphin',
'dolphin_1_cat2': 'feline',
'dolphin_2_dog2': 'canine'
}
On the other hand, is possible to convert that dict into an object with dynamic attributes:
from activejson import FrozenJSON
frozen_complex_json = FrozenJSON(complex_json)
print(frozen_complex_json.cat.grass)
print(frozen_complex_json.cat.mud)
print(frozen_b.dolphin[2].dog2)
The result could be the next:
'feline'
'you never know'
'canine'
To retrieve the underlying json, is possible to use the json property:
frozen_complex_json.json
{
'cat_grass': 'feline',
'cat_horse': 'my joke',
'cat_mud': 'you never know',
'dog': 'canine',
'dolphin_0_tiger_0_bird': 'blue jay',
'dolphin_0_tiger_1_fish': 'dolphin',
'dolphin_1_cat2': 'feline',
'dolphin_2_dog2': 'canine'
}
Development setup
This project uses Poetry for dependecy resolution. It's a kind of mix between pip and virtualenv. Follow the next instructions to setup the development enviroment.
$ pip install poetry
$ git clone https://github.com/dany2691/activejson.git
$ cd activejson
$ poetry install
To run the test-suite, inside the pybundler directory:
$ poetry run pytest test/ -vv
Meta
Daniel Omar Vergara Pérez – @__danvergara __ – daniel.omar.vergara@gmail.com -- github.com/danvergara
Valery Briz - @valerybriz -- github.com/valerybriz
Contributing
- Fork it (https://github.com/BentoBox-Project/activejson)
- Create your feature branch (
git checkout -b feature/fooBar) - Commit your changes (
git commit -am 'Add some fooBar') - Push to the branch (
git push origin feature/fooBar) - Create a new Pull Request
Metadata
Release files for activejson 0.4.0
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 |
|---|---|---|---|---|
| activejson-0.4.0.tar.gz | 4.6 kB | Without provenance | Details for activejson-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| activejson-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for activejson-0.4.0-py3-none-any.whl |
Total release size: 9.1 kB
Release files / activejson-0.4.0.tar.gz
| Download URL | activejson-0.4.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9c04393c5e4d219e4a6c730a51e134933022cb9d984f443c5ea753ac66c815e
|
|
BLAKE2b-256 checksum How to use checksums |
676ebf55cbfdfb313e766e2d50c78978ce9e371f649bc10b48f87963ef9158f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.8.2 Linux/5.0.0-1035-azure
|
Release files / activejson-0.4.0-py3-none-any.whl
| Download URL | activejson-0.4.0-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
86b91df5279e15f3b6e41c878b4d14f60d8dd3a43348eb08f7695969ef36698c
|
|
BLAKE2b-256 checksum How to use checksums |
1849512b5df9ca210b9c1bc40473bebdfa2befd96401b38323577f5128532d4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.8.2 Linux/5.0.0-1035-azure
|
Security for activejson 0.4.0
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.