Skip to main content

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+F search that highlights matching keys/values with Enter/Shift+Enter navigation
  • 📋 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

MIT

Metadata

Release files for llm-prettier 0.1.1

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

Source distribution (sdist)

Source distribution for llm-prettier 0.1.1
File Size Uploaded
llm_prettier-0.1.1.tar.gz 13.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-prettier 0.1.1
File Interpreter ABI Platform
llm_prettier-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.4 kB

Release files / llm_prettier-0.1.1.tar.gz

Download URL llm_prettier-0.1.1.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
83914473eb1893c859a09eeeaa9653d9339899019c19a97069b513677aeb4208
BLAKE2b-256 checksum
How to use checksums
16dd566395bf4a3230934d643a10b3a47d02fe3564a6b0dcbd99098e76dcff4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 6, 2026.

Transparency log

Release files / llm_prettier-0.1.1-py3-none-any.whl

Download URL llm_prettier-0.1.1-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a3afae5673d226fa01f324107b3d9490ad56bca08e072d15e3d1fd9ab0082f8
BLAKE2b-256 checksum
How to use checksums
a467fde053f68d46ffdd7fb27d7ef083eca9306fe35fbe0dad52eaed1c920b6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 6, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 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