8 min read

TOON vs Minified JSON: When Compact JSON Wins

The latest TOON benchmark shows compact JSON beats TOON on mixed, nested data, while TOON wins big on uniform tables. Here is how to choose for your payload.

By json2toon.co

Minified JSON beats TOON on deeply nested and semi-uniform data, while TOON wins clearly on uniform tables. In the official TOON benchmark, TOON was 35.2% smaller than minified JSON on flat data but 1.6% larger on mixed structures. If your pipeline already minifies JSON, measure your own payload shape before you switch.

Why compare TOON with minified JSON at all?

Most TOON savings figures, including "about 40% fewer tokens", are measured against pretty-printed JSON with indentation and line breaks. Many production pipelines never send that. They call JSON.stringify(data) without spacing, which removes all whitespace. That is the real baseline for them, and it is much harder to beat.

The current official benchmark (spec v4.1, 5,856 LLM calls) adds a "JSON compact" column for this comparison (token-efficiency results). Its headline is still 42.6% fewer tokens than JSON, but the per-dataset split against minified JSON tells a more nuanced story.

Where does minified JSON beat TOON?

Benchmark datasetTabular eligibilityTOON vs JSONTOON vs minified JSON
Semi-uniform event logs50%−15.0%+19.9%
Deeply nested configuration0%−34.9%+6.7%
E-commerce orders (nested)33%−32.9%+5.6%
Top 100 GitHub repositories100%−41.7%−23.2%
Feature flags keyed by name100%−54.6%−32.8%
Time-series analytics100%−59.0%−35.9%
Uniform employee records100%−60.7%−36.8%
Contacts with nested groups100%−66.5%−42.9%
Mixed-structure track totalvaries−32.7%+1.6%
Flat-only track total100%−58.7%−35.2%

The pattern is clear. TOON beats pretty JSON on every dataset, but it beats minified JSON only when most of the data fits a table, which is what the eligibility column measures. At 50% eligibility or below, minified JSON wins. The TOON README says the same in its "When Not to Use TOON" section: for deeply nested or non-uniform structures, "compact JSON often wins outright."

Why does minified JSON win on nested data?

TOON saves tokens by stating field names once in a header and then writing rows of values. A config tree has no rows to factor out: every key appears once anyway. TOON then spends tokens on indentation that minified JSON does not have. We encoded a small config with @toon-format/toon 4.1.1 and counted tokens with o200k_base: 101 tokens as pretty JSON, 56 as minified JSON, 67 as TOON.

{"app":{"server":{"http":{"port":8080,"host":"0.0.0.0","tls":{"enabled":true,"cert":"/etc/ssl/app.pem"}}},"cache":{"redis":{"url":"redis://cache:6379","ttl":300}}}}
app:
  server:
    http:
      port: 8080
      host: 0.0.0.0
      tls:
        enabled: true
        cert: /etc/ssl/app.pem
  cache:
    redis:
      url: "redis://cache:6379"
      ttl: 300

Semi-uniform logs fail for a related reason. When objects in an array don't share the same fields, TOON falls back to list form: one indented block per item, with keys repeated. Three log events with different optional fields came to 98 tokens minified and 115 as TOON in our test.

Where does TOON beat minified JSON?

On uniform data, minified JSON still repeats every key and quote in every object. TOON does not. Four user records came to 69 tokens minified and 47 as TOON:

{"users":[{"id":1,"name":"Alice","role":"admin","active":true},{"id":2,"name":"Bob","role":"viewer","active":false},{"id":3,"name":"Carol","role":"editor","active":true},{"id":4,"name":"Dan","role":"viewer","active":true}]}
users[4]{id,name,role,active}:
  1,Alice,admin,true
  2,Bob,viewer,false
  3,Carol,editor,true
  4,Dan,viewer,true

The gap grows with row count. At 50 users of the same shape we measured 1,609 tokens pretty, 855 minified and 461 as TOON, which is 46% below minified JSON. TOON v4 also extends this to more shapes: maps of uniform objects become keyed tables, and arrays with uniform sub-objects use nested field groups. That is why the feature-flags and contacts datasets show big wins even against minified JSON. Our TOON v4 overview explains both forms.

Is TOON more accurate than minified JSON?

A little, on average. Across all 244 questions TOON scored 72.2% ±2.8 and minified JSON 69.0% ±2.9, with 2,474 vs 2,892 average tokens per prompt (retrieval-accuracy results). Minified JSON had the second-best efficiency, at 23.8 accuracy points per 1K tokens vs 29.2 for TOON. On the 109 flat-dataset questions the gap was larger: 63.1% for TOON vs 58.0% for minified JSON, which scored lowest of all formats there.

Results differ by model and dataset. On deeply nested config, minified JSON and TOON tied at 91.4%. Minified JSON was cheaper there, so it is the better choice for that shape.

How do you choose between TOON and minified JSON?

  • Mostly uniform arrays or maps (API lists, query results, records by ID): use TOON.
  • Deep config trees and one-off objects: use minified JSON.
  • Semi-uniform events with optional fields: minified JSON, unless you can normalize the fields first.
  • Purely flat tables: consider CSV. The README notes TOON adds about 5–10% over CSV in exchange for declared lengths and field lists.
  • Latency-bound local models: the README warns that some deployments process compact JSON faster despite more tokens, so measure time to first token.

A cheap rule is to encode both and send the smaller one. Paste a sample into the JSON to TOON converter to compare token counts. For more of the trade-offs, see when not to use TOON and how TOON handles nested data.

Frequently Asked Questions

Is TOON smaller than minified JSON?

It depends on the data shape. In the official TOON benchmark, TOON was 35.2% smaller than minified JSON on flat, uniform tables, but 1.6% larger on the mixed-structure track. Minified JSON won on semi-uniform event logs (TOON +19.9%), deeply nested config (+6.7%) and nested e-commerce orders (+5.6%).

Why does compact JSON beat TOON on nested data?

TOON saves tokens by declaring field names once for many rows. Deeply nested or non-uniform data has no repeated rows, so there is nothing to factor out. TOON then pays for indentation on every line, while minified JSON spends only a few braces and quotes. The TOON README says compact JSON often wins outright here.

Is TOON more accurate than minified JSON?

In the current official benchmark, TOON scored 72.2% (plus or minus 2.8) and minified JSON 69.0% (plus or minus 2.9) across 5,856 calls, with TOON using 2,474 average tokens against 2,892. The intervals nearly touch, so treat it as a small edge. On flat datasets the gap was wider: 63.1% vs 58.0%.

Should I compare TOON against pretty JSON or minified JSON?

Against minified JSON, if that is what you would otherwise send. Most headline savings, including the 42.6% figure, are measured against pretty-printed JSON. If your pipeline already minifies, the extra saving from TOON is smaller and only appears on uniform arrays and maps.

Recommended Reading

TOONJSONBenchmarkToken EfficiencyData FormatLLM