A library to prase Json Tree data in-order to make things simpler
Project description
JSONJ
JsonJ is a simple Python Library that allows parsing Complicated Nested Json tree to a Simple Json data. This Library allows converting Complicated Nested Json Data to an Intermediate Simple Json Data, which make it easier to process the original data.
Example Data Conversion
########################## FROM #########################################
{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}
########################### TO #########################################
{
'menu': {
'path': 'menu',
'isRoot': True,
'children': ['menu/id', 'menu/value', 'menu/popup']
},
'menu/id': {
'path': 'menu/id',
'isRoot': False,
'children': []
},
.
.
.
'menu/popup/menuitem/2/value': {
'path': 'menu/popup/menuitem/2/value',
'isRoot': False,
'children': []
},
'menu/popup/menuitem/2/onclick': {
'path': 'menu/popup/menuitem/2/onclick',
'isRoot': False,
'children': []
}
}
As you can see, this converted format is Elegant and can be Applied to a Various Task.
Converted Data Format Description
.
.
.
'menu/popup/menuitem/2/value': {
'path': 'menu/popup/menuitem/2/value',
'isRoot': False,
'children': []
},
.
.
.
- The key of the data is set to be the path of that particular node from the root Node
- Each Key has a value which in turn is a simple Json with 3 parameters.
- path: The path of the particular node from the root node (same as that of the key)
- isRoot: Either it's a Root node or not
- children: Wheather the particular node has any children or not
Installation
$ pip3 install JsonJ
Usage
from JsonJ import JsonJ
json = JsonJ(<sample_json_data>)
NOTE: PLEASE MAKE SURE THE JSON DATA IS VALID, AS OF NOW THE LIBRARY DOES NOT CHECK WHETHER THE DATA IS VALID OR NOT, BUT THIS VALIDATION WILL BE DONE SOON
Detailed Usage
- get_parsed_data() - This function call returns the Intermediate Parsed data
- clean() - This function call clears all the data saved in local variables
Development
Want to contribute? Great! All you have to do is a Pull Request and start Working
Todo's
- Search by node
- Search by value
- Json data validator
- And a lot has to be done
License
MIT
PEACE
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 JsonJ-0.1.6.tar.gz
.
File metadata
- Download URL: JsonJ-0.1.6.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fc9085939ce5e2c11bf5917ca5cb7a69dab739ecfc8f877a3287e069ae2dcc9 |
|
MD5 | 07e010a7c128a93f8fcb87e2c828702e |
|
BLAKE2b-256 | b3ca202fe97c4828e9bf9384df236b024a089633b5b8f28797b060ca69a33e9a |
File details
Details for the file JsonJ-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: JsonJ-0.1.6-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f009ab265a13f781d568d66d43d40b90a7909cdf54ded2a88998dd36433819e0 |
|
MD5 | 36449ac2218d820d03aa2472073222b6 |
|
BLAKE2b-256 | 3087e9d9c22e994111c96e3683b8696b2620f01526d67f73ad879bec15755001 |