Every time a new format appears, the instinct is to ask whether it replaces the old one. That is the wrong question for TOON.

TOON does not replace JSON. It solves a narrower problem.

JSON remains one of the most important data formats in software because it is lightweight, standardized, language-independent, and deeply embedded in modern systems. TOON, or Token-Oriented Object Notation, was created for a different pressure: getting structured data into and out of large language models with less token overhead and clearer row-oriented structure.

That distinction matters.

JSON is the system format. TOON is the model-context format.

What is JSON?

JSON stands for JavaScript Object Notation. It is a lightweight text format for representing structured data using objects, arrays, strings, numbers, booleans, and null values.

A basic JSON example looks like this:

{
  "users": [
    { "id": 1, "name": "Alice", "role": "admin" },
    { "id": 2, "name": "Bob", "role": "user" }
  ]
}

Why JSON matters:

  • it is standardized
  • it is widely supported
  • it maps cleanly to common programming structures
  • it works well for APIs, config, storage, and interoperability

Its weakness is not that it is bad. It is that, for LLM workloads, it can be verbose. Repeated keys, braces, quotes, and punctuation consume tokens even when they add little new information for the model.

What is TOON?

TOON stands for Token-Oriented Object Notation. It is a compact, human-readable representation of the JSON data model designed for LLM-facing workflows.

A comparable TOON example looks like this:

users[2]{id,name,role}:
  1,Alice,admin
  2,Bob,user

Instead of repeating the keys id, name, and role for every row, TOON declares the fields once and then lists the values row by row. That is where much of the token savings comes from.

TOON is especially attractive when your data looks like repeated records:

  • logs
  • test failures
  • product catalogs
  • inventories
  • tabular retrieval payloads
  • repeated issue or event rows

The important caution is that TOON is still newer and less mature than JSON. Its ecosystem is growing, but it is not yet the universal default for software systems.

The core difference

TOON vs JSON comparison

JSON and TOON represent the same general kind of structured information, but they optimize for different priorities.

JSON optimizes for:

  • interoperability
  • maturity
  • broad ecosystem support
  • familiarity

TOON optimizes for:

  • token efficiency
  • structured prompt payloads
  • repeated row-oriented data
  • explicit model-facing schemas

That is why my recommendation is not to choose one over the other. It is to use both where they make sense.

Why TOON is interesting for AI-assisted development

LLM systems care about tokens, not just bytes or characters. If your prompt contains thousands of repeated field names and punctuation marks, that overhead competes with the actual business content you want the model to reason about.

The benchmark data from the TOON repository makes this concrete. When ranking formats by efficiency — defined as accuracy per 1,000 tokens — TOON leads the field:

FormatEfficiencyAccuracyTokens
TOON27.776.4%2,759
JSON compact23.773.7%3,104
YAML19.974.5%3,749
JSON16.475.0%4,587
XML13.872.1%5,221

Efficiency = accuracy % ÷ tokens × 1,000. Higher is better. Source: toon-format/toon

The headline number: TOON achieves 76.4% accuracy while using 39.9% fewer tokens than standard JSON — and actually edges out JSON’s accuracy in the process. That is not a marginal improvement. That is a meaningful shift in how much useful work you can get done within a fixed context window.

It is also worth noting that CSV was excluded from this ranking — it is token-efficient for flat tabular data but cannot represent nested structures, making it unsuitable for most real-world AI workloads.

That does not mean TOON always wins. It means TOON is worth considering when token pressure is meaningful.

TOON tends to be strongest when it is doing the job it was designed for: structured model-facing data that is more complex than CSV but more repetitive than arbitrary nested JSON.

Where JSON is still the right answer

JSON should remain your default for:

  • public APIs
  • internal service contracts
  • frontend/backend exchange
  • storage formats
  • tool calls
  • schema-driven integrations
  • places where mature validators and existing libraries matter more than token savings

If another system expects JSON, send JSON.

Where TOON is the right answer

TOON is a strong choice when all three of these are true:

  1. The data is going into or coming out of an LLM.
  2. The payload contains repeated structure, especially uniform arrays of objects.
  3. Token cost, latency, or context-window pressure matters enough to justify a conversion step.

Good TOON use cases:

  • feeding CI test failures into an LLM
  • passing logs or alerts into an incident-analysis agent
  • sending catalog or record batches into a retrieval or classification prompt
  • compressing structured evidence before model reasoning
  • asking a model to return row-based intermediate output you can validate

This is the pattern I recommend:

JSON inside the system. TOON at the prompt boundary. JSON again after validation.

That gives you the upside without forcing your whole stack to learn a new contract format.

A simple example: test failures

Here is JSON:

{
  "failures": [
    {
      "test": "UserServiceTest.shouldCreateUser",
      "module": "identity-service",
      "errorType": "AssertionError",
      "durationMs": 183
    },
    {
      "test": "UserServiceTest.shouldRejectDuplicateEmail",
      "module": "identity-service",
      "errorType": "TimeoutError",
      "durationMs": 5001
    }
  ]
}

Here is TOON:

failures[2]{test,module,errorType,durationMs}:
  UserServiceTest.shouldCreateUser,identity-service,AssertionError,183
  UserServiceTest.shouldRejectDuplicateEmail,identity-service,TimeoutError,5001

The system can still store and transport JSON. But right before the prompt, you convert it to TOON, because the model does not need repeated keys on every row.

The model receives the same information in fewer tokens — and fewer tokens means more room for reasoning, examples, or additional context in the same window.

A simple example: service dependencies

Here is JSON:

{
  "dependencies": [
    { "service": "payments", "dependsOn": "auth", "criticality": "high" },
    { "service": "payments", "dependsOn": "ledger", "criticality": "high" },
    { "service": "checkout", "dependsOn": "auth", "criticality": "high" }
  ]
}

Here is TOON:

dependencies[3]{service,dependsOn,criticality}:
  payments,auth,high
  payments,ledger,high
  checkout,auth,high

If you are asking a model, “What is the likely blast radius if auth is degraded?”, the TOON version often makes better use of the context window because more of the prompt is actual signal and less is repeated syntax.

Where TOON is a bad fit

TOON is not a magic upgrade for every case.

Be cautious when:

  • the structure is deeply nested and irregular
  • the payload is small enough that token savings barely matter
  • your model or framework expects JSON-native structured output
  • your team will pay more in confusion than it gains in efficiency
  • you need maximum compatibility with existing APIs and tooling

TOON becomes more compelling as the payload gets larger and more repetitive. For small or simple structures, the extra prompt instructions or examples may reduce its advantage.

A good example of a poor fit is a deeply nested configuration object — something like a Kubernetes manifest or a Webpack config. The structure is irregular, fields are not repeated across rows, and the nesting carries meaning. Flattening it into TOON row notation either loses that meaning or produces something harder to read than the original JSON.

The decision framework

Here is the most practical decision tree for this topic.

Use JSON when:

  • another system expects JSON
  • the payload is an API contract
  • you need mature tooling and validation
  • the structure is irregular or deeply nested
  • team familiarity matters more than prompt compression

Use TOON when:

  • the payload is for an LLM
  • the data is repetitive and row-oriented
  • token budget matters
  • context-window pressure matters
  • you can automatically convert in and out
  • you can validate the result before reusing it

Use both when:

  • your system of record is JSON
  • your AI layer benefits from TOON
  • you want interoperability without paying unnecessary token tax

That is the pattern worth building toward.

What this is actually about

Not: “JSON is obsolete.”

But rather: “JSON remains the contract format. TOON is a useful optimization format for model-facing structured data.”

Final take

JSON is still the right default for software systems.

TOON becomes interesting when you cross into LLM-heavy workflows and want to reduce token waste without losing structure. Its value is not in replacing the ecosystem. Its value is in improving one specific layer of the stack: the boundary where structured data meets a model.

That is why my recommendation is simple:

Use JSON for systems. Use TOON for model context.

References