A Python package to visualize JSON as a vertical graph(support drf-spectacular).
Project description
JsonCrack 📊
JsonCrack is a Python package that visualizes JSON as a vertical graph to help developers understand complex JSON structures easily Supporting drf-spectacular Schema.
🚀 Features
💚 Convert JavaScript-style JSON (null, true, false) → Python (None, True, False)
💚 Generate vertical graph visualization of JSON data
💚 Automatically detects OS to display the graph (Windows, Mac, Linux)
💚 No need for a web interface—runs locally
💚 Support drf-spectacular—Visualize Django Rest Framework Documentation Example Responses
📚 Installation
-
Install Graphviz (required for rendering graphs):
- Windows: Download and install from Graphviz website
- Mac:
brew install graphviz
- Linux (Debian/Ubuntu):
sudo apt install graphviz
-
Install JsonCrack:
pip install JsonCrack
🔥 Quick Start
data is in java script style
1⃣ Convert JavaScript-style JSON to Python
from JsonCrack.Cracker import JSON
data = '''
{
"name": "Alice",
"active": true,
"address": null
}
'''
# Convert JS JSON to Python format
json_obj = JSON(data)
python_json = json_obj.convert_js_to_python()
print(python_json)
🟢 Output:
{'name': 'Alice', 'active': True, 'address': None}
2⃣ Visualize JSON Data
json_obj.visualize(display=True, output_file="visualize_output",)
📌 This will open a PNG file with name visualize_output displaying the JSON structure as a vertical graph.
🟢 Output:

3⃣ Convert & Visualize in One Step with display(default)
from JsonCrack.Cracker import JSON
data = [{
"name": "Alice",
"active": True,
"address": None
},
{
"name": "Salma",
"active": False,
"address": "New York"
}
]
json_obj = JSON(data)
json_obj.visualize()
🟢 Output:
3⃣ Convert & save Visualize in One Step without display
from JsonCrack.Cracker import JSON
data = {
"name": "Alice",
"active": True,
"address": None
}
json_obj = JSON(data)
json_obj.visualize(display=False)
3⃣ Integration With Django
#add this to Django settings.py
REST_FRAMEWORK={'DEFAULT_SCHEMA_CLASS': 'JsonCrack.AutoSchema'}
🟢 Example Results:
http://localhost:8000/media/xhvo+f6^l-\IIXVAMJC1J.png
http://localhost:8000/media/xhvo+f6^l-\HM2VFKK0VN.png
http://localhost:8000/media/xhvo+f6^l-\2WB4HC5DAU.png

🛠 Development
- Clone the repository:
git clone https://github.com/MahmoudGShake/JsonCrack.git cd JsonCrack
- Install dependencies:
pip install -r requirements.txt
- Install package in editable mode:
pip install -e .
👥 Contributing
We welcome contributions! 🎉
- Fork the repository
- Create a new branch (
git checkout -b feature-branch) - Make your changes
- Commit and push (
git commit -m "Added new feature" && git push origin feature-branch) - Create a pull request
🐝 License
MIT License - Free to use and modify. See LICENSE for details.
💡 Future Improvements
🚧 Planned features:
- Interactive web-based visualization
- More export formats (SVG, PDF, JSON Tree)
- Better error handling for invalid JSON
🌟 Show Your Support
🌟 Star this repository on GitHub if you find it useful!
💬 Feel free to open issues for bug reports & feature requests.
Happy Coding! 🚀
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jsoncrack-0.2.1.tar.gz.
File metadata
- Download URL: jsoncrack-0.2.1.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b3e015cd80e68a266628fd6939a0e7e1ca1ba63d9d3d0c7d6de71d1498ebcf0
|
|
| MD5 |
0d81facd38b7649e53300b6807e7223a
|
|
| BLAKE2b-256 |
de6c5bce37ed8157420db58de99ff63cf5f1e53ce399638e5ede26f79f12867b
|
File details
Details for the file jsoncrack-0.2.1-py3-none-any.whl.
File metadata
- Download URL: jsoncrack-0.2.1-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3120f2eb70f0af3a4c828e0c5d18a642444a09740a957a17a15043a46920c881
|
|
| MD5 |
bd64e8677a1b233a432e5eb6b4e65f5b
|
|
| BLAKE2b-256 |
dc416de3833afaa51bdb92efe39f8acda194125a7f112beff8d4d183840b7810
|