A tiny desktop app to view JSON as an interactive tree using Cacao.
pip install cacao-json-viewer
# From a file
cacao-json-viewer path/to/data.json
# Or via stdin
cat data.json | cacao-json-viewer
Now with simplified imports! Use the package directly in your Python code:
import json
from cacao_json_viewer import preview_json
# Load your JSON data
with open("data.json", "r") as f:
data = json.load(f)
# Preview it in a desktop window
preview_json(data, title="My JSON Data")
import json
from cacao_json_viewer import preview # Even cleaner!
data = {
"name": "John Doe",
"age": 30,
"skills": ["Python", "JavaScript", "SQL"],
"address": {
"street": "123 Main St",
"city": "New York",
"zipcode": "10001"
}
}
# Same function, cleaner name
preview(data, title="User Profile", width=900, height=700)
import json
import requests
from cacao_json_viewer import preview_json
# Fetch data from an API
response = requests.get("https://api.example.com/data")
data = response.json()
# Preview the API response
preview_json(data, title="API Response")
preview_json(
data, # Your JSON data (dict, list, or any JSON-serializable object)
title="Cacao JSON Viewer", # Window title
width=800, # Window width in pixels
height=600, # Window height in pixels
)
- 🍫 Simple & Clean: Minimal setup, maximum functionality
- 🌳 Interactive Tree View: Expand/collapse JSON nodes
- 🖥️ Desktop Application: Native desktop window using Cacao
- 📦 Easy Import: Clean import syntax -
from cacao_json_viewer import preview_json
- Python 3.8+
- Cacao framework
MIT