Skip to main content

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 & filterCtrl+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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_prettier-0.1.1.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_prettier-0.1.1-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

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

Hashes for llm_prettier-0.1.1.tar.gz
Algorithm Hash digest
SHA256 83914473eb1893c859a09eeeaa9653d9339899019c19a97069b513677aeb4208
MD5 ba366b32e406a0eaa54a5bf93d6d6b20
BLAKE2b-256 16dd566395bf4a3230934d643a10b3a47d02fe3564a6b0dcbd99098e76dcff4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_prettier-0.1.1.tar.gz:

Publisher: publish.yml on amaruki/llm-prettier

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for llm_prettier-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a3afae5673d226fa01f324107b3d9490ad56bca08e072d15e3d1fd9ab0082f8
MD5 b94b7971f0c8941792ecc1a8302d91eb
BLAKE2b-256 a467fde053f68d46ffdd7fb27d7ef083eca9306fe35fbe0dad52eaed1c920b6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_prettier-0.1.1-py3-none-any.whl:

Publisher: publish.yml on amaruki/llm-prettier

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page