Tech and AI

JSON vs TOON: cutting the token cost of data you send to AI models

What the TOON format is, how it writes lists of records in far fewer tokens than JSON, when it helps, and when to stick with JSON.

If you send data to an AI model through an API, you pay for every token, and JSON is a surprisingly wasteful way to send it. TOON (Token-Oriented Object Notation) is an open format published in late 2025 that carries the same data in fewer tokens. Here’s what it is, when it helps and when it doesn’t.

Where JSON wastes tokens

Take a list of 100 orders, each with an id, date, customer and total. In JSON, the four key names are repeated 100 times, every key and string sits in quotes, and every record is wrapped in braces. None of that is information the model needs; it’s packaging, and you pay for it in tokens and in context window space.

What TOON does differently

TOON writes a uniform list as a table. The field names appear once in a header, with the number of rows, and each record becomes one line of comma-separated values:

orders[3]{id,date,customer,total}:
  1001,2026-11-01,Ana,49.90
  1002,2026-11-01,Ben,12.50
  1003,2026-11-02,Chen,230.00

Nested objects use indentation, like YAML, and quotes appear only when a value needs them. The row count and field list act as a check, so a model can notice if data has been cut off.

How much it saves

  • Lists of similar records (orders, products, log lines, search results): typically 30% to 60% fewer tokens than formatted JSON. This is where TOON shines.
  • Small or deeply nested objects: little or no saving, and sometimes more tokens than compact JSON.
  • Against minified JSON the gap is smaller, because minifying already removes whitespace.

On a large uniform dataset that can mean roughly halving the input cost of every request that includes it, or fitting twice as many rows into the context window.

When to use it

  • Yes: putting tables of data into prompts, retrieval results, analytics extracts, and agent tool results that return lists.
  • Maybe: mixed data. Test with your own payloads; the saving depends on the shape.
  • No: APIs between programs, config files, or anywhere other software expects JSON. TOON is for the model-facing edge, not a JSON replacement.

Do models understand it?

Modern models read TOON well without special instructions because it looks like YAML and CSV, which they’ve seen huge amounts of. Published benchmarks show retrieval accuracy on TOON input similar to or slightly better than JSON. Asking models to write TOON is less reliable; keep asking for JSON output when another program will parse the answer.

Try it

Paste any JSON into the JSON to TOON converter to see the TOON version and an estimate of the tokens saved. It runs in your browser, so nothing you paste is uploaded. For production use, official TOON libraries are available for JavaScript, Python and other languages.