Claude Discovery

← All discoveries

Vivid, blurred close-up of colorful code on a screen, representing web development and programming.
Photo by Markus Spiske on Pexels
library

condense-json 1.0: One Library, Eighteen Months, Zero Drama

2026-08-03 ยท source:

condense-json 1.0 is a Python library that compresses deeply nested JSON into a shorter, still-readable form for pasting into LLM prompts or logs.

What it is

condense-json is a small Python library by Simon Willison for collapsing verbose, deeply nested JSON structures into a more compact representation, first released about a year and a half ago and now stable at 1.0.

What it does

It takes a JSON document and produces a condensed form that preserves structure and meaning while cutting the token count, useful before pasting API responses or logs into a prompt or a terminal. The 1.0 release applies sensible, non-disruptive fixes rather than a rewrite.

Why it matters

Instead of manually truncating or reformatting bulky JSON before feeding it to an LLM, this gives you a drop-in way to shrink it without losing the shape of the data, which matters when every extra token costs money and context window space.

How to use it

Install it as a Python dependency (via pip or uv) and call its condense function on any JSON-serializable object or string before logging it or including it in a prompt.

Go to source →
pythonjsonlibraryllm-tooling