What is TOON? The Token-Oriented Object Notation Explained

What is TOON?

In the era of Large Language Models (LLMs) like GPT-4, Claude, and Gemini, data efficiency is more critical than ever. Every character counts, and every token costs money. Enter TOON (Token-Oriented Object Notation), a new data format designed specifically to bridge the gap between human readability and machine efficiency.

The Problem with JSON

JSON (JavaScript Object Notation) is the de facto standard for data interchange. It's easy for humans to read and easy for machines to parse. However, it's notoriously verbose.

Consider a simple array of user objects:

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

Notice how the keys "id", "name", and "role" are repeated for every single object? In a large dataset, this redundancy wastes a massive amount of tokens. For an LLM with a limited context window (and a cost-per-token pricing model), this is inefficient.

The TOON Solution

TOON solves this by borrowing concepts from CSV (Comma-Separated Values) but keeping the hierarchical flexibility of JSON. It separates the schema (the keys) from the data (the values).

Here's the same data in TOON:

|id|name|role|
1|Alice|Admin
2|Bob|User
3|Charlie|User

Key Benefits

  1. Token Reduction: By removing repeated keys and structural syntax (like braces and quotes), TOON can reduce token usage by 20-40%.
  2. Human Readability: Unlike binary formats (like Protobuf) or compressed strings, TOON remains easy for humans to read and edit.
  3. LLM Compatibility: LLMs are surprisingly good at understanding header-based table structures. TOON leverages this natural capability.

When to Use TOON

TOON is ideal for:

  • Prompt Engineering: Including large datasets in your system prompts.
  • RAG (Retrieval-Augmented Generation): Storing and retrieving data chunks more efficiently.
  • API Responses: Reducing bandwidth and parsing overhead for AI agents.

Conclusion

As we build more complex AI applications, optimizing our data formats becomes a crucial optimization step. TOON offers a pragmatic middle ground: efficient enough for machines, readable enough for humans.

Ready to try it out? Use our free converter to transform your JSON to TOON today.