Skip to main content

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

Release files for JsonJ 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for JsonJ 0.1.6
File Size Uploaded
JsonJ-0.1.6.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for JsonJ 0.1.6
File Interpreter ABI Platform
JsonJ-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 8.3 kB

Release files / JsonJ-0.1.6.tar.gz

Download URL JsonJ-0.1.6.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0fc9085939ce5e2c11bf5917ca5cb7a69dab739ecfc8f877a3287e069ae2dcc9
BLAKE2b-256 checksum
How to use checksums
b3ca202fe97c4828e9bf9384df236b024a089633b5b8f28797b060ca69a33e9a
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / JsonJ-0.1.6-py3-none-any.whl

Download URL JsonJ-0.1.6-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f009ab265a13f781d568d66d43d40b90a7909cdf54ded2a88998dd36433819e0
BLAKE2b-256 checksum
How to use checksums
3087e9d9c22e994111c96e3683b8696b2620f01526d67f73ad879bec15755001
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page