TOON (Token-Oriented Object Notation) is a compact serialization format designed specifically for sending structured JSON data to large language models — think RAG pipelines, agent tool calls, and chatbot context windows — while staying human-readable. According to TOON's published benchmarks (see the TOON specification), TOON uses roughly 42.6% fewer tokens than equivalent JSON for typical structured data, with comparable-or-better LLM retrieval accuracy (72.2% vs JSON's 71.4% in their test suite). In this article, we'll unpack where those savings come from and why they matter for anyone paying for LLM prompt tokens or working within a context-window budget.
📊 Token & Size Comparison
The headline figure from TOON's published benchmarks is a ~42.6% reduction in tokens compared to equivalent JSON, measured across typical structured data sent to LLMs. The table below illustrates the kind of data shapes where that reduction shows up most — lists of records with the same fields, which is the common shape for API responses and database query results:
| Data Shape (illustrative) | JSON Tokens | TOON Tokens | Reduction |
|---|---|---|---|
| API response list (100 records, uniform fields) | ~100% | ~55-60% | ~40-45% fewer tokens |
| Nested user + address objects | ~100% | ~70-80% | ~20-30% fewer tokens |
| Flat key-value config | ~100% | ~75-85% | ~15-25% fewer tokens |
| TOON published benchmark average (typical structured data) | - | - | ~42.6% fewer tokens |
The per-row percentages above are illustrative, based on typical structure for each data shape — not a formal benchmark study. The bottom row (~42.6%) is the figure reported in TOON's published benchmarks across their test suite.
The reduction is largest for uniform arrays of objects — the classic shape of API
responses and database query results — because that's exactly the case TOON's core
mechanism targets: a single header row listing field names once
(items[N]{col1,col2}:),
followed by comma-separated rows, instead of repeating each object's keys the way JSON
does for every single record.
🔄 Conversion Example
Here's a small, concrete example — a typical API response listing user records — shown in both formats. We counted the raw characters for this specific example (not a formal benchmark): the JSON version is 240 bytes and the TOON version is 113 bytes, about a 53% reduction for this one snippet. Actual savings on your own data will vary with shape and size, which is why TOON's own published benchmarks (~42.6% fewer tokens on average) are the more reliable reference point:
📄 JSON (240 bytes)
{
"users": [
{ "id": 1, "name": "Alice Johnson", "role": "admin", "active": true },
{ "id": 2, "name": "Bob Smith", "role": "editor", "active": true },
{ "id": 3, "name": "Carol Lee", "role": "viewer", "active": false }
]
}
📝 TOON (113 bytes)
users[3]{id,name,role,active}:
1,Alice Johnson,admin,true
2,Bob Smith,editor,true
3,Carol Lee,viewer,false
Notice what's happening: JSON repeats the keys id,
name,
role, and
active for every single
record. TOON declares the field names exactly once in the header
({id,name,role,active})
and then lists each row as plain comma-separated values. For a 3-row example the win is
modest; for a 100-row API response, that repeated-key overhead in JSON compounds fast —
which is exactly why this pattern is the single biggest lever behind TOON's token savings.
TOON also eliminates:
- Quote marks around property names and simple string values
- Repeated keys for every object in a uniform array
- Curly braces for object delimiters
- Array brackets for simple arrays
🚀 Real-World Impact for LLM Prompts
These token savings matter most wherever structured data is sent into an LLM's context window — RAG retrieval, agent tool-call results, and chatbot prompts:
⚡ Fewer Prompt Tokens
~42.6% fewer tokens (published benchmark)
Fewer tokens per request means more of your context window is left for instructions, conversation history, and the model's own reasoning.
💾 Lower API Cost
Fewer input tokens billed per request
Most LLM providers bill by input token count. Cutting the tokens needed to represent the same structured data lowers the cost of every prompt that includes it, especially at scale.
🧠 Comparable-or-Better Accuracy
72.2% vs JSON's 71.4% (TOON's test suite)
Sending fewer tokens doesn't come at the cost of retrieval accuracy — TOON's published benchmarks report LLM retrieval accuracy on par with or slightly better than JSON.
🔄 More Room in Context
More records per context window
When a model has a fixed context-window budget, using fewer tokens per record means you can fit more retrieved documents or tool results into the same prompt.
📈 Where These Numbers Come From
We haven't run our own large-scale benchmark study on this site. The token and accuracy figures cited above are the ones published by the TOON specification itself:
- Source: TOON's published benchmarks, part of the TOON specification and reference implementation
- Headline metric: ~42.6% fewer tokens than equivalent JSON for typical structured data
- Accuracy metric: 72.2% LLM retrieval accuracy for TOON vs 71.4% for JSON, in their test suite
- What we added: the small, illustrative JSON-vs-TOON example above, with its character counts computed directly from that one snippet
Illustrative Example (this article's snippet only)
User-list example above:
JSON size: 240 bytes
TOON size: 113 bytes
Reduction: ~52.9%
TOON's published benchmark (typical structured data):
Token reduction: ~42.6% fewer tokens than JSON
Retrieval accuracy: 72.2% (TOON) vs 71.4% (JSON)
🌍 Where This Matters in LLM Workflows
TOON's token savings apply wherever structured data gets serialized into a prompt. A few common places that shows up:
📚 RAG Pipelines
Benefit: retrieved documents and records take up fewer tokens, leaving more of the context window for the query, instructions, and generated answer.
Best fit: uniform lists of retrieved records (search results, database rows) — the exact shape where TOON's header-row encoding saves the most.
🤖 AI Agents & Tool Calls
Benefit: tool results (API responses, database query output) are serialized more compactly before being fed back into the agent's next turn.
Best fit: multi-step agent loops where the same structured tool output gets passed through the context repeatedly.
💬 Chatbots & Conversational AI
Benefit: structured context (user profile data, product catalogs, order history) injected into the system or user prompt costs fewer tokens per turn.
Best fit: long-running conversations where the same structured context is repeated across many turns.
☁️ Server-Side LLM Integrations
Benefit: lower per-request token counts translate directly into lower input-token billing on providers that charge per token.
Best fit: high-volume endpoints that repeatedly send structured JSON payloads (API responses, form data) into an LLM prompt.
💰 Cost Implications
Fewer tokens per prompt translate into real, direct savings for anyone calling an LLM API:
For Teams Building on LLM APIs
- Fewer input tokens billed per request on token-metered providers
- More retrieved records or tool results fit inside a fixed context window
- Lower risk of hitting context-length limits on large data payloads
- Data stays human-readable, so it's easy to debug prompts by hand
For High-Volume Products
- Per-request token savings compound across millions of API calls
- Comparable-or-better retrieval accuracy means no quality trade-off
- Simple, line-oriented syntax that's easy to generate and parse
- Drop-in for existing JSON-shaped data via a JSON-to-TOON conversion step
🔮 Where TOON Fits Going Forward
As LLM usage keeps shifting toward agentic workflows and larger retrieved context, a few practical considerations are worth keeping in mind:
Biggest Wins on Uniform Data
The token savings scale with how uniform your data is — the more records share the same fields, the more the header-row encoding pays off.
Easy to Adopt Incrementally
Since TOON maps directly from JSON, you can convert just the data-heavy parts of a prompt (tool results, retrieved records) without rewriting your whole data pipeline.
Spec Is Open and Evolving
TOON is an open, actively maintained specification — check the reference implementation on GitHub for the latest tooling and benchmark methodology.
💡 Recommendations
Based on how TOON's savings mechanism works, here are our recommendations for when to use it:
✅ Use TOON When:
- Sending structured JSON data into LLM prompts (RAG, agents, chatbots)
- Your data is a uniform array of objects with the same fields (API responses, DB rows)
- Prompt token cost or context-window budget is a real constraint
- You still want the serialized data to be human-readable for debugging
- You're operating at high request volume, where per-request token savings compound
⚠️ Consider JSON When:
- Interoperability with existing JSON-based systems or APIs is required
- The data isn't going into an LLM prompt at all (e.g. it's just internal storage)
- Your data is deeply nested or highly irregular, where the header-row savings don't apply
- Integration with systems that don't yet support TOON
🚀 Ready to Cut Your Prompt Tokens?
Ready to see the token savings on your own data? Start by converting your existing JSON payloads and comparing the token count before and after: