A generic JSON prettier and interactive HTML viewer, built especially for parsing embedded JSON from LLM payloads and responses.
Project description
llm-prettier
A simple, generic JSON prettier and interactive HTML viewer with a killer feature for developers working with LLM APIs: it automatically detects and parses embedded stringified JSON, rendering it as a full interactive tree rather than a raw escaped string.
Features
- 🌲 Interactive tree view — Collapsible nodes for any JSON structure
- 🔍 Search & filter —
Ctrl+Fsearch that highlights matching keys/values withEnter/Shift+Enternavigation - 📋 Copy to clipboard — Hover any value or key to copy it; click any key to copy its full JSON path
- 🗺️ JSON path breadcrumb — Displays the full path (e.g.
$.choices[0].message.content) on key click - 📊 Stats bar — Shows total key count, max depth, and data size at a glance
- 🔢 Depth controls — Collapse to depth D2, D3, D4 in addition to expand/collapse all
- 🪡 Embedded JSON parsing — Automatically detects and renders stringified JSON, including JSON inside Markdown code blocks (
json ...) and XML tags (<tool_call> ... </tool_call>) - 💡 Fully local — No external dependencies; everything runs in-browser from a single HTML file
Installation
Using pip:
pip install llm-prettier
Using uv (faster):
uv pip install llm-prettier
After installing, the llm-prettier CLI will be available.
Usage
CLI Tool
# Prettify a JSON file (saves as viewer_<name>.html)
llm-prettier path/to/response.json
# Open in browser immediately via local server
llm-prettier path/to/response.json --serve
# Specify custom output file
llm-prettier path/to/response.json -o my_output.html
# Read from stdin
cat response.json | llm-prettier -
curl https://api.example.com/data | llm-prettier - --serve
# Custom server port
llm-prettier response.json --serve --port 8080
# Print version
llm-prettier --version
# Run it without installing globally
uv run llm-prettier response.json --serve
Python API
import llm_prettier
my_data = {
"model": "gemini-flash",
"message": {
"content": "{\"tool_call\": {\"temperature\": 0.8}}"
}
}
# Generate HTML string
html_str = llm_prettier.render_html(my_data, title="My LLM Response")
# Save to file; returns the absolute path on success
out_path = llm_prettier.show(my_data, out_name="viewer_mydata.html")
Viewer Keyboard Shortcuts
| Key | Action |
|---|---|
Ctrl+F |
Focus search bar |
Enter |
Next search match |
Shift+Enter |
Previous search match |
Escape |
Clear search |
License
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 llm_prettier-0.1.1.tar.gz.
File metadata
- Download URL: llm_prettier-0.1.1.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83914473eb1893c859a09eeeaa9653d9339899019c19a97069b513677aeb4208
|
|
| MD5 |
ba366b32e406a0eaa54a5bf93d6d6b20
|
|
| BLAKE2b-256 |
16dd566395bf4a3230934d643a10b3a47d02fe3564a6b0dcbd99098e76dcff4f
|
Provenance
The following attestation bundles were made for llm_prettier-0.1.1.tar.gz:
Publisher:
publish.yml on amaruki/llm-prettier
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_prettier-0.1.1.tar.gz -
Subject digest:
83914473eb1893c859a09eeeaa9653d9339899019c19a97069b513677aeb4208 - Sigstore transparency entry: 1046603958
- Sigstore integration time:
-
Permalink:
amaruki/llm-prettier@6604d23b717c3cf5e6b54b4f47aaa7541a936cdc -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/amaruki
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6604d23b717c3cf5e6b54b4f47aaa7541a936cdc -
Trigger Event:
release
-
Statement type:
File details
Details for the file llm_prettier-0.1.1-py3-none-any.whl.
File metadata
- Download URL: llm_prettier-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a3afae5673d226fa01f324107b3d9490ad56bca08e072d15e3d1fd9ab0082f8
|
|
| MD5 |
b94b7971f0c8941792ecc1a8302d91eb
|
|
| BLAKE2b-256 |
a467fde053f68d46ffdd7fb27d7ef083eca9306fe35fbe0dad52eaed1c920b6e
|
Provenance
The following attestation bundles were made for llm_prettier-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on amaruki/llm-prettier
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_prettier-0.1.1-py3-none-any.whl -
Subject digest:
8a3afae5673d226fa01f324107b3d9490ad56bca08e072d15e3d1fd9ab0082f8 - Sigstore transparency entry: 1046604127
- Sigstore integration time:
-
Permalink:
amaruki/llm-prettier@6604d23b717c3cf5e6b54b4f47aaa7541a936cdc -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/amaruki
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6604d23b717c3cf5e6b54b4f47aaa7541a936cdc -
Trigger Event:
release
-
Statement type: