TOON: Token-Oriented Object Notation
What is TOON?
TOON (Token-Oriented Object Notation) is a compact, human-readable data format designed specifically for LLM prompts. It encodes the same data as JSON but uses significantly fewer tokens.
The idea is simple: when you’re sending data to an LLM, you’re paying for tokens. JSON is verbose. TOON is not.
Here’s the same data in JSON:
{
"users": [
{ "id": 1, "name": "Alice", "role": "admin" },
{ "id": 2, "name": "Bob", "role": "user" }
]
}
And in TOON:
users[2]{id,name,role}:
1,Alice,admin
2,Bob,user
That’s it. Same data, ~40% fewer tokens.
What’s in it for you?
- Lower costs – fewer tokens = cheaper API calls
- Better accuracy – benchmarks show 74% retrieval accuracy vs JSON’s 70%
- Lossless – it’s a 1:1 mapping to JSON, round-trips perfectly
- LLM-friendly – explicit
[N]lengths and{fields}headers help models parse reliably
”But that’s just CSV!”
I get it. It looks like CSV at first glance. But it’s not.
CSV is flat. TOON handles nested objects, arrays within arrays, and mixed structures. The tabular syntax you see is just one part of the format – it kicks in when you have uniform arrays of objects (which is the most common case in real-world data).
For nested or non-uniform data, TOON uses YAML-like indentation. Best of both worlds.
Also, CSV has no schema. TOON’s [N]{field1,field2} header tells the model exactly what to expect – how many rows, what columns. That structure helps LLMs validate and parse data correctly.
My implementations
I’ve been experimenting with TOON and built a couple of implementations:
Check them out if you’re working in those ecosystems.
Learn more
- Official TOON repository
- TOON Playground – try it live
- Full specification