TOON: The Data Format Changing How AI Agents Think
Software Developer

Something fascinating is happening in artificial intelligence — especially where humans build systems that talk to large language models (LLMs) like GPT-4 or Claude.
The problem isn’t the models themselves; it’s the data we feed them.
For years, JSON has been the default choice for structuring information.
Now there’s a challenger — not here to replace JSON everywhere, but to dominate where tokens matter.
Its name: TOON (Token-Oriented Object Notation).
Why Everyone’s Talking About TOON
LLMs charge by the token, and every bracket, quote, and whitespace eats into your budget — or your context window.
TOON is engineered to cut the fat. By removing redundant syntax, it delivers the same structure in fewer tokens.
The result: more context, lower cost, and cleaner reasoning.
Unlike JSON, TOON isn’t optimized for machines — it’s optimized for humans and LLMs communicating efficiently.
If you’re building AI agents, orchestrating prompts, or sending structured information into models, TOON could slash your token usage in half.
JSON vs TOON: A Side-by-Side View
Traditional JSON
{
"user": {
"id": 123,
"name": "Akira"
},
"tags": [
"agent",
"llm"
]
}
Same data in TOON
user:
id: 123
name: Akira
tags[2]:
agent
llm
No braces. No extra quotes. Just structure.
Indentation defines hierarchy, like YAML — but with a laser focus on token efficiency.
The TOON Mindset: Less Is More
TOON rewrites how we represent data:
- Objects → indentation replaces braces.
- Arrays → length annotated up front (
tags[2]:), each item on its own line. - Strings → unquoted unless necessary (special chars or whitespace).
The format is human-readable, LLM-friendly, and remarkably compact.
Fewer distractions = fewer hallucinations, faster reasoning.
Getting Practical: Converting JSON to TOON
.NET Example
using System.Text.Json;
using ToonSharp;
string jsonData = await File.ReadAllTextAsync("users.json");
var users = JsonSerializer.Deserialize>(jsonData);
string toonData = ToonSerializer.Serialize(users);
Console.WriteLine(toonData);
Note: I’ve built a NuGet package named Toon.Serde — a learning-oriented serializer inspired by the TOON format.
It mirrors this same JSON-to-TOON conversion logic in .NET, letting developers experiment locally with token-optimized serialization.
The project is open-source, designed to help engineers understand how format design influences LLM efficiency.
JavaScript / TypeScript Example
import { serialize } from '@toon-format/toon';
const data = {
user: { id: 123, name: "Akira" },
tags: ["agent", "llm"]
};
const toonString = serialize(data);
console.log(toonString);
TOON can also deserialize back to JSON — useful when working across backend and frontend environments.
Why It Matters for LLMs
Every token counts with GPT-4, Claude, or Many More.
By cutting out 40–60% of syntactic overhead, TOON allows:
- More data per prompt
- Smaller bills
- Cleaner context windows
It’s not just efficiency — it’s reliability.
With less noise, models misinterpret structure less often, improving logical consistency in multi-step reasoning.
Real-World Workflows: Cross-Platform Serialization
Developers commonly serialize on the backend and manipulate or visualize on the frontend.
Here’s how a typical TOON workflow looks:
Backend (.NET):
- Load or compute data as JSON.
- Serialize to TOON.
- Send it as a plain string to LLMs or client apps.
Frontend (Node.js/React):
- Use
@toon-format/toonfor client-side serialization or parsing. - Pass TOON to models or render it for review.
End-to-end:
- .NET backend → TOON serialization → API response
- Node.js frontend → parse TOON → inject into LLM prompt
- LLM → returns efficient, token-light output
Where TOON Shines
TOON works best anywhere data needs to move efficiently between AI systems or prompts:
- Agent Workflows: Share structured data between multiple AI agents without exceeding token limits.
- Prompt Design: Fit more instructions, examples, and context into every LLM call.
- Multi-Agent Communication: Keep conversations between agents lightweight and easy to parse.
- Low-Cost APIs: Send less data per request — ideal for startups, open-source projects, and budget-conscious teams.
Final Thoughts
TOON isn’t another transient data — it’s a token-aware communication layer for the AI era.
It complements JSON rather than replaces it, giving developers an LLM-optimized format for modern workloads.
Whether you’re tuning agents, building context pipelines, or just trying to do more with fewer tokens, TOON is a format worth adopting.
If you’re interested in building your own TOON serializer, check out my GitHub repository — it walks through how TOON serialization works internally and can serve as a practical learning reference.



