JDogo vs TOON
Both formats write a header once and rows of values. Here is where they differ, measured on the same 200 payloads with the same tokenizer.
The short version
| JDogo | TOON | |
|---|---|---|
| Prompt tokens, 60 production payloads | 113,654 | 163,049 (+43%) |
| Prompt tokens, all 200 cases | 609,460 | 850,782 (+40%) |
| Gzipped, all 200 cases | 332 KB | 399 KB |
| Exact round trips, all 200 cases | 200 | 192 |
| Cases where TOON is smaller | 0 of 60 | |
| Models reading rows, correct answers | 313 of 444 | 315 of 444 |
Tokens counted with cl100k (GPT-4). TOON is JToon 2.0.9, the official Java implementation of TOON spec v4.4. Every case is on the benchmarks page.
On TOON's own benchmark
TOON publishes one of its benchmark datasets as a data file: the top 100 GitHub repositories. scripts/toon_upstream_benchmark.py downloads it from TOON's repository at a pinned commit and counts it with the same tokenizer TOON uses (o200k). Our JSON and TOON counts reproduce TOON's published ones exactly.
| Top 100 GitHub repositories | Tokens | vs TOON |
|---|---|---|
| JSON, pretty (TOON's figure: 15,337) | 15,337 | +71.6% |
| JSON, compact (11,640) | 11,640 | +30.2% |
| TOON (8,937) | 8,937 | baseline |
| CSV, TOON's figure | 8,711 | −2.5% |
| JDogo | 8,233 | −7.9% |
This dataset is flat and full of unique text, which leaves less to remove than the mixed payloads above, so the margin is smaller. JDogo still beats TOON and CSV, and decodes back exactly.
Where JDogo pulls ahead
- Values, not just keys. TOON removes repeated keys. JDogo also stores ids as steps, lifts shared prefixes and suffixes, writes constant columns once and uses dictionaries for repeated strings.
- Nested data. TOON falls back to indented
key: valuelines inside nested objects. JDogo keeps nested objects and lists of objects in the header (customer{name,tier},items[]{sku,qty}), so rows stay flat. - Exactness. JDogo returns every test value exactly. TOON changed 8 cases: recursive trees and DAGs, number extremes, 50-digit decimals, 200-bit integers and IEEE-754 special values.
- Exact answers to questions. With
ask(), models wrote queries that got 150 of 150 counting questions right. Reading TOON rows directly, the same models got 72.
Where they're even
When a model reads rows directly, accuracy is about the same in JSON, TOON and JDogo: 309, 315 and 313 correct of 444 across six models. Neither format makes models smarter. JDogo gets there with the smallest prompt: 12,147 tokens across those runs, against 18,109 for TOON and 20,941 for JSON.
Where TOON is a fine choice
- People read the text more often than machines do, and YAML-style indentation is what they expect.
- Data is small and flat, and exact round trips of extreme numbers don't matter.
Switching from TOON
Decode your TOON with its library, then write JDogo with dumps, stringify or DocCodec.encode. JDogo readers also accept plain JSON, so services can move one at a time. Try your own payload in the playground: it shows JDogo and TOON side by side, with an exact round-trip check for each.