How to Save on AI? TOON vs JSON: A New Format for Structured Prompts
Up to 60% token savings, the new TOON format, advantages of TOON for LLMs, comparison with JSON, data processing optimization

As prompts get heavier and models get more powerful, the main question is: how can we reduce token costs and speed up processing? When working with LLMs in code, structured data in JSON has already become the standard. We continue to cram massive JSON, YAML, or plain text datasets into prompts. This is not only expensive and slow, but also extremely inefficient in terms of tokens.
It is no surprise that, sooner or later, a format designed to solve exactly this problem had to emerge, and its name is TOON.
The TOON format: A relative of JSON and CSV
TOON is a new data format, something in between JSON and CSV. It remains human-readable while being optimized for LLMs and tokenization. According to the developers, using TOON reduces token counts by 30-60%, which can translate to significant savings when working with APIs.
What makes TOON interesting?
- Token savings: up to 60% less than JSON
- Predictability for LLMs: explicit fields and lengths allow for validation
- Minimal syntax: no extra quotes, brackets, or commas
- Hierarchy via indentation: similar to YAML
- Tabular arrays: keys are declared once, and data follows in rows
JSON example:
{
"users": [
{ "id": 1, "name": "Alice", "role": "admin" },
{ "id": 2, "name": "Bob", "role": "user" }
]
}
TOON example:
users[2]{id,name,role}:
1,Alice,admin
2,Bob,user
Why does this matter?
If you are building systems that regularly feed structured data into LLMs—whether they are chatbots, code generators, or multi-step pipelines—TOON can literally cut your prompt size nearly in half.
And it is not just about the money, though saving 50% on tokens is a nice bonus. Fewer tokens mean higher speed and lower latency.
This is especially critical for real-time systems and streaming APIs.

When should you NOT use TOON?
TOON works great with homogeneous arrays of objects, but there are situations where other formats might be a better fit.
1. Deeply nested or irregular structures
If the data is difficult to represent as a table, TOON loses its purpose. In such cases, compact JSON might even be more token-efficient. Example: complex configurations with many levels of nesting.
2. Semi-homogeneous arrays
When the data structure is only partially tabular (roughly 40-60%), the token savings decrease.
3. Purely tabular data (CSV)
If you have a standard table without hierarchies, CSV remains the most compact. TOON adds only a small "overhead" layer (about 5-10%) of fields, lengths, and delimiters to increase reliability when working with LLMs.
Documentation and links
Let me know in the comments: do you use only JSON, and what do you think about the new TOON format?
If you are interested in AI, technology, and the future—welcome to my channel to discuss and share updates.
Translated from Russian. Original on vc.ru: Как экономить на AI? TOON vs JSON. Новый формат структурированных промтов