# condense-json 发布了 1.0 版本，提供 JSON 压缩功能，通过替换重复字符串减少存储空间，用于 LLM 日志等场景

- 来源：Simon Willison
- 发布时间：2026-08-03 06:19
- AIWatch 分数：58
- AIWatch 标记：未精选
- AIWatch 链接：https://aiwatch.icu/events/evt_01kz2dtazcwp9d39v6ma14vf8n
- 原文链接：https://simonwillison.net/2026/Aug/2/condense-json/#atom-everything

## 精选理由

常规快讯，保留列表

## AI 摘要

condense-json 发布了 1.0 版本，提供 JSON 压缩功能，通过替换重复字符串减少存储空间，用于 LLM 日志等场景。

## 正文

Release: condense-json 1.0

I'm trying to get braver at releasing 1.0 versions. This little library is a year and a half old now - I've applied some sensible and non-disruptive fixes and shipped the big 1.0 for it.

Here's an example of what it can do, lifted from the README:

{
  "foo": {
    "bar": {
      "string": "This is a string with foxes in it",
      "nested": {
        "more": ["Here is a string", "another with foxes in it too"]
      }
    }
  }
}

Combine that with a replacements object:

{"1": "with foxes in it"}

And condense_json(input_json, replacements) produces the following:

{
  "foo": {
    "bar": {
      "string": {"$r": ["This is a string ", {"$": "1"}]},
      "nested": {
        "more": ["Here is a string", {"$r": ["another ", {"$": "1"}, " too"]}]
      }
    }
  }
}

It scans for strings or substrings that are present in that replacements object and replaces those with a special {"$r": ...} syntax in the output.

You can reverse the effect with uncondense_json(condensed, replacements).

The idea is to make it easier to store JSON that includes duplicated data from other related structures. I use it to save space in the SQLite logs generated by LLM - see PR #1586 for the latest iteration of that.

Tags: json, projects, python, llm
