JSON ↔ TOON

What is TOON (Token-Oriented Object Notation)?

TOON, short for Token-Oriented Object Notation, is a compact text format for structured data. It carries the same information as JSON but strips the redundant punctuation that large language models pay for by the token — typically reducing token usage by 30-60%.

The problem TOON solves

When you send structured data to an LLM like GPT-4, Claude, or Gemini, you pay per token. JSON spends a large share of those tokens on syntax that carries no information: opening and closing braces, square brackets, commas between every field, and quotation marks around every key and string. For an array of objects, JSON also repeats every field name on every single record.

TOON keeps the data and throws away the ceremony. Structure is expressed through indentation (like YAML), quotes are dropped where they are unnecessary, and arrays of objects declare their field names once as a header instead of repeating them per row.

A quick example

The same data, in JSON and in TOON:

// JSON — 38 tokens (approx)
{
  "users": [
    { "id": 1, "name": "Ada",  "active": true },
    { "id": 2, "name": "Linus","active": false }
  ]
}

// TOON — ~22 tokens (approx)
users:
  - id: 1
    name: Ada
    active: true
  - id: 2
    name: Linus
    active: false

The data is identical and the conversion is lossless — you can turn TOON back into the exact same JSON. Only the format changed.

Why LLMs handle TOON well

TOON looks a lot like YAML and indented outlines that appear throughout model training data, so models parse it naturally. Independent benchmarks have shown comparable — sometimes slightly better — extraction accuracy with TOON than with JSON, while using far fewer tokens. Fewer tokens means lower cost and more room in the context window for actual content.

When TOON helps most: arrays of similar objects (tables, records, API responses), RAG context, chat history, and any prompt where you are pasting large structured payloads. For a single tiny object, the savings are small.

When to use it (and when not to)

  • Great fit: feeding tabular or repeated data into prompts, compressing RAG context, trimming long tool outputs before they re-enter the model.
  • Neutral: tiny payloads where token count barely matters.
  • Not a fit: machine-to-machine APIs between your own services — there, stick with JSON. TOON is for the LLM boundary.

Try it on your own data

The fastest way to understand TOON is to paste a real JSON payload into the free converter and watch the live token count drop. Everything runs in your browser — your data never leaves your machine.