
If you’ve used tools like ChatGPT, Claude, or Gemini, you’ve already seen how powerful large language models can be. But behind every response, there’s something most people don’t notice: cost is tied directly to how much data you send.
Every prompt isn’t just a question. It often includes instructions, context, memory, and structured data. All of this gets converted into tokens, and more tokens mean higher cost and slower processing.
That’s where TOON comes in.
TOON (Token-Oriented Object Notation) is a more efficient way to represent structured data when working with AI. Instead of repeating the same fields over and over like traditional formats, it reduces redundancy while preserving meaning.
In this guide, you’ll learn what TOON is, how it works, and why it can significantly reduce token usage and improve performance in real AI systems.
What Is TOON?
TOON (Token-Oriented Object Notation) is a data representation format designed to reduce token usage when sending structured data to AI models. It works by minimising repetition in data structures while preserving the same meaning.
Unlike traditional formats like JSON, which repeat field names for every record, TOON defines the structure once and represents the data more compactly. This makes it more efficient for AI systems, where every extra token increases cost and processing time.
In simple terms, TOON is a smarter way to format structured data so AI models can process the same information using fewer tokens.
The Hidden Cost of AI Conversations
When you send a request to an AI model, it’s not just a question.
Behind the scenes, each request often includes instructions, documents, retrieved context, conversation history, and metadata.
All of this is converted into tokens, the unit that determines cost and processing time.
More tokens = higher cost and slower responses.
You’re not just sending data to AI - you’re paying for every repeated word.
What looks like a simple query can actually be hundreds or even thousands of tokens.
That’s where the real problem begins.
Because in production systems, this adds up quickly, increasing costs and reducing efficiency at scale.
So the real question is:
Can we send the same information in a more efficient way?
How Data Is Normally Sent to AI (Using JSON)
Most AI systems use JSON, a structured format to organise data before sending it to a model.
Here’s a simple example:
import json
payload = {
"task": "summarize",
"document": "Long report text...",
"metadata": {"source": "internal"}
}
prompt = json.dumps(payload)This entire payload is converted into text and sent to the model.
Example: Data in JSON
{
"teams": [
{
"name": "Team F22",
"members": [
{ "id": 1, "name": "Alice" },
{ "id": 2, "name": "Bob" }
]
}
]
}
JSON is widely used because it’s clear, readable, and easy to work with.
But there’s a hidden inefficiency.
The Problem With Repetition
Now consider a slightly larger dataset:
[
{"id":1,"name":"Phone","price":699},
{"id":2,"name":"Tablet","price":399},
{"id":3,"name":"Laptop","price":1299}
]At first glance, this looks fine.
But notice what’s happening:
- The keys “id”, “name”, and “price” are repeated in every single record
- The structure is duplicated again and again
For humans, this repetition doesn’t matter.
Walk away with actionable insights on AI adoption.
Limited seats available!
But for AI systems, every repeated key becomes a token, and tokens directly impact cost and performance.
That repetition adds up quickly.
Enter TOON: A Smarter Representation
TOON stands for Token-Oriented Object Notation.
It’s a data representation format designed to reduce repetition when sending structured data to AI models.
Instead of repeating the same keys for every record, TOON defines the structure once and represents the data more compactly.
This means the same information can be expressed using fewer tokens, without losing meaning or clarity.

Switching From JSON to TOON
Switching from JSON to TOON is straightforward. Instead of serializing data using JSON, you encode it using TOON.
Here’s a simple example:
pip install python-toonfrom toon import encode
prompt = encode(payload)That’s it.
You’re sending the same data, just in a more compact and efficient representation.
Same Data With Toon:
Here’s how the same data looks when represented using TOON:
teams[1]:
- name: Team F22
members[2]{id,name}:
1,Alice
2,BobInstead of repeating keys like “id” and “name” for every record, TOON defines the structure once and lists only the values.
This reduces repetition while keeping the data easy to understand.
Where TOON Works Best
TOON works best when the data you’re sending is structured and repetitive.
Think of cases where the same fields show up again and again, that’s exactly where TOON makes the biggest difference.
Common examples:
- Tables — rows with the same columns repeated across records
- Logs — repeated fields like timestamps, events, and statuses
- Search results — lists of items with identical attributes
- Agent memory — stored interactions with consistent structure
- Tool inputs — function calls with repeated parameter keys
- Large datasets — any bulk data with repeating patterns
Where TOON Doesn’t Change Much
TOON is most effective when there’s repeated structure. When that structure is missing, there’s simply less to optimise.
If your data is mostly natural, free-form text, it’s already fairly compact and doesn’t repeat keys or patterns.
Common cases:
- ArticlesLong-form content is written as continuous text, not structured fields. There’s no repeated schema for TOON to compress.
- EmailsMost emails are conversational and unstructured, with minimal repetition in format or fields.
- ReportsNarrative-heavy reports focus on text rather than repeated data structures, so there’s little redundancy to remove.
In these scenarios, TOON still works, but the gains are limited because the data is already expressed efficiently.
How TOON Performs in Real-World Scenarios/
To understand where TOON helps, we ran experiments comparing JSON, TOON, and plain prompts across two scenarios:
- A structured dataset (many repeated fields)
- A real document (mostly natural language)
This helps show when TOON really makes a difference.
Scenario 1 - Structured Dataset (100 Records)
| Format | Avg Prompt Tokens | Avg Completion Tokens | Avg Total Tokens | Avg Latency |
JSON | 4264 | 173 | 4437 | 4.15 s |
TOON | 2071 | 169 | 2240 | 3.82 s |
Result: About 51% reduction in prompt size using TOON.
What this means
When data contains repeated fields (like tables or logs), TOON dramatically reduces token usage, which translates directly into lower cost and faster processing.

Scenario 2 - Real Document (Internship Report)
| Format | Avg Prompt Tokens | Avg Completion Tokens | Avg Total Tokens | Avg Latency |
NORMAL | 2287 | 171 | 2458 | 4.15 s |
JSON | 2473 | 175 | 2648 | 3.73 s |
TOON | 2443 | 166 | 2609 | 3.27 s |
Result: Only small differences.
What this means
When most of the input is plain text, there’s very little repetition to compress, so TOON offers limited benefit.

Key Insight
These results point to a simple idea:
Walk away with actionable insights on AI adoption.
Limited seats available!
TOON works best when structure dominates the data.It matters less when the input is mostly natural text.
That’s exactly how real AI systems behave, structured data benefits the most, while free-form text sees limited gains.
Why This Matters for the Future of AI
As AI gets integrated into more products, optimizing inference performance becomes a real constraint.
It’s not just about choosing the right model - it’s also about how efficiently data is sent and processed.
In many systems, a large portion of tokens comes from structure, not actual content. That means small improvements in how data is represented can have a meaningful impact at scale.
In practice, this leads to:
- Lower costs - fewer tokens sent per request, especially in structured workflows
- Better scalability - systems can handle more requests without increasing overhead
- More usable context - token limits can be used for meaningful data instead of repeated structure
As usage grows, these gains become more noticeable.
TOON doesn’t change how AI works, it improves how we communicate with it in scenarios where structure dominates.

Frequently Asked Questions (FAQs)
What is TOON in AI?
TOON (Token-Oriented Object Notation) is a data format designed to reduce token usage when sending structured data to AI models by minimizing repeated fields.
How is TOON different from JSON?
JSON repeats field names for every record, while TOON defines the structure once and only sends the values, making it more compact.
Does TOON always reduce token usage?
No. TOON is most effective with structured, repetitive data. For natural language content, the impact is minimal.
When should you use TOON?
Use TOON when working with structured data like tables, logs, search results, or large datasets with repeated fields.
Does TOON improve response speed?
It can. Fewer tokens mean less data to process, which can slightly reduce latency in many cases.
Is TOON hard to implement?
No. Switching from JSON to TOON is straightforward and usually only changes how data is serialized, not the data itself.
Does TOON affect model output quality?
No. TOON changes the representation of input data, not the meaning, so output quality remains the same.
Conclusion
TOON doesn’t replace JSON, it improves how structured data is sent to AI models.
When data is repetitive, it can significantly reduce token usage. When it’s mostly natural language, the impact is minimal.
It doesn’t change what you send, only how efficiently it’s represented.
As AI systems scale, these small optimizations start to matter more. Because in the end, efficiency isn’t just about models, it’s also about how you communicate with them.
Walk away with actionable insights on AI adoption.
Limited seats available!



