What is TOON (Token-Oriented Object Notation)?

As Large Language Models (LLMs) like GPT-4, Claude, and Gemini become central to software development, optimizing how we feed data to them has become a critical challenge. The standard format, JSON, is excellent for machines but surprisingly inefficient for LLMs due to its repetitive syntax.

Enter TOON (Token-Oriented Object Notation), a new data format designed specifically to minimize token usage while maintaining human readability.

In this guide, we'll explore what TOON is, how it works, and why it might be the best choice for your next LLM-powered application.


1. The Problem with JSON for LLMs

JSON is verbose. For a list of 100 users, you repeat the keys "id", "name", and "email" 100 times. You also use thousands of quotes, colons, and braces.

For a traditional API, this overhead is negligible. But for an LLM, every character counts towards your token limit.


2. How TOON Solves It

TOON reduces token usage by adopting two main strategies: Tabular Arrays and Clean Syntax.

Tabular Arrays

Instead of repeating keys for every object in an array, TOON defines them once in a header row.

JSON:

[
  { "id": 1, "name": "Alice", "role": "Admin" },
  { "id": 2, "name": "Bob", "role": "User" },
  { "id": 3, "name": "Charlie", "role": "User" }
]

TOON:

users:
[3]
  {id,name,role}
  1,"Alice","Admin"
  2,"Bob","User"
  3,"Charlie","User"

Clean Syntax

TOON removes unnecessary punctuation like opening/closing braces for objects and commas at the end of lines, relying on indentation (similar to YAML) to define structure.


3. JSON vs TOON: A Comparison

| Feature | JSON | TOON | | :--- | :--- | :--- | | Structure | Braces {} and Brackets [] | Indentation and Headers | | Array Format | List of Objects | Tabular (CSV-like inside) | | Token Usage | High (Repetitive keys) | Low (Optimized) | | Readability | Good for deep nesting | Excellent for lists | | Parsing | Native in all languages | Requires TOON parser |

Token Savings Example

For a dataset of 50 items with 5 keys each:


4. When to Use TOON


5. Tools to Get Started

Ready to try TOON? We have built free tools to help you convert and format your data.


Conclusion

While JSON remains the king of web APIs, TOON is the future of LLM data exchange. By switching to a token-optimized format, you can significantly reduce your API bills and make your AI applications faster and smarter.

Start optimizing your prompts today with FormatJSONOnline's TOON Tools.