json4tree
Makes any JSON compatible with D3's hierarchy or tree chart formats.
Installation
Since this tool is exclusively Python3, you'll need pip3 to install:
pip3 install json4tree
You can also download and install the package directly from PyPi.
Usage
If your Python3 library is included in your path, try running json4tree directly from the command line:
# if you have your Python3 scripts added to your path, use this one:
json4tree input.json output.json
# otherwise, use this one:
python3 -m json4tree input.json output.json
If you need to import it as a module in your Python3 script, do it like so:
# import the necessary modules
import json
import json4tree
# import your JSON data
infile = open("input.json", "r")
json_file = json.load(infile)
infile.close()
# create a new handler
converter = json4tree.handler(json_file)
# You can either print your results...
converter.results
# Or you can save your results
outfile = open("output.json", "w")
outfile.write(converter.results)
outfile.close()
Examples
Here is an example input file from Merriam-Webster's Dictionary API and the resulting output file.
Release files for json4tree 1.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 | |
|---|---|---|---|
| json4tree-1.0.2.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| json4tree-1.0.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / json4tree-1.0.2.tar.gz
| Download URL | json4tree-1.0.2.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
addb4315021bb7256ca9ef8569cedc53ee04760a63fa0270110b3c68a36c2921
|
|
BLAKE2b-256 checksum How to use checksums |
315198b4889469e31938d2484e4617d4482eb328b922703fc52da15bd322be21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2
|
Release files / json4tree-1.0.2-py2.py3-none-any.whl
| Download URL | json4tree-1.0.2-py2.py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
6221affa15c221d13eda9486115bb26b29c756966bbb8ad6d37c0227cd57a217
|
|
BLAKE2b-256 checksum How to use checksums |
4d6009fbcd677e5e7f4a82943764c68cfa95f886eed636c694eefbca9fda346e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2
|