The short version
Simon Willison releases condense-json 1.0, a Python library that compresses JSON by replacing repeated strings with reversible references.
Developer Simon Willison has released version 1.0 of his condense-json Python library. This tool compresses JSON data by swapping repeated strings for a special reference syntax, which you can expand later to rebuild the original. Willison applies it to save space in logs for his LLM project.
Key takeaways
- Simon Willison released condense-json 1.0, a Python library for JSON compression.
- It replaces repeated strings with a reversible
{"$r": ...}reference syntax. - The primary functions are
condense_json()anduncondense_json(). - It is designed to reduce redundancy when storing JSON with duplicated data.
- Willison uses it to save space in SQLite logs for his LLM project.
The Core Function: Condensing and Expanding JSON
Its main function is condense_json(input_json, replacements). This scans the input JSON for strings or substrings found in a supplied replacements object. When matches occur, the function swaps those strings for a special {“$r”: …} syntax in the output, making a compressed, reference-based structure.
For instance, with a JSON object and a replacements object like {“1″: ” with foxes in it “}, the function outputs condensed JSON where the matched substring becomes a reference such as {“$”: “1”} inside an “$r” array. You can fully reverse this process using the companion function uncondense_json(condensed, replacements), which rebuilds the original JSON with the same replacements object. This approach helps store JSON that has duplicated data from related structures.
Practical Application and Example
This condense-json tool helps store JSON that includes duplicated data from other related structures, which saves space. A README example shows this process.
Example of Condensation
It starts with a nested JSON object containing the repeated phrase “with foxes in it”. A separate replacements object maps this exact phrase to the key “1”. When the condense_json function processes the input JSON with these replacements, it creates a condensed output.
In the condensed result, the tool swaps the full repeated phrase for references like {"$": "1"}. These references sit inside a {"$r": ...} structure. For example, the string ” This is a string with foxes in it ” becomes {"$r": [ " This is a string ", {"$": " 1 " }]}. This substitution cuts redundancy in the JSON text.
The function scans for strings or substrings present in the replacements object. You can reverse the effect with uncondense_json(condensed, replacements). Simon Willison mentions using it to save space in SQLite logs generated by LLM.
Development Context and Real-World Use
Simon Willison called this release part of an effort to get “braver at releasing 1.0 versions.” He said the condense-json library is a year and a half old and has seen sensible, non-disruptive fixes, prompting him to ship the stable 1.0 version. His blog announced the release on August 2, 2026.
Practical Application in LLM
Willison specifically applies the tool to save space in the SQLite logs generated by LLM, a project he maintains. This integration appears in PR #1586 for its latest iteration. The utility condenses JSON by scanning for strings present in a supplied replacements object and swapping them with a special {“$r”: …} syntax, which you can later reverse. This makes storing JSON with duplicated data from related structures simpler.
📡 Original reporting: Simon Willison. AI Craft Technologies’ news engine summarised and rewrote this story in our own words; facts are drawn from the linked source.
⚙️ How this article was made — fully automated
This is a live demo of the ACT News Factory engine. Want one running on your own site? See our services →



