Skip to content

What is the TOON format, and when does it save tokens?

TOON writes the same data as JSON in fewer tokens, but only for some shapes of data. Here is what it looks like and what our own counts showed.

By OpenAnyDoc ·

The short answer

TOON (Token-Oriented Object Notation) is an open text format for the same data as JSON, made to use fewer tokens when you paste data into an AI chat. It writes a list of objects with the same keys as one header line of field names and then one row of values per item, and nested objects with indentation instead of braces. It saves a lot on long, uniform lists and little or nothing on deeply nested or irregular data, especially compared with minified JSON.

What it looks like next to JSON

Take three synthetic orders. Formatted JSON repeats every key for every order and spends a line on each brace, 137 tokens in our test. The same data in TOON is four lines and 60 tokens:

  • orders[3]{id,product,quantity,price,status}:
  • 1001,Notebook,1,0.5,paid
  • 1002,Pen,8,13.5,shipped
  • 1003,Stapler,3,26.5,pending

How to read it

The first line says: a list called orders, with 3 items, and these five fields. Each indented line is one item, with its values in the order of the fields. The item count and the field names act as a check, so a reader can tell when a row is missing or has a value too many.

Data that is not a uniform list looks like indented key: value lines, much like YAML. Text is quoted only when it has to be, for example a version written as "1.2" keeps its quotes so it stays text and is not read as a number. A list of mixed items is written with a dash before each item.

When it saves tokens, in our test

We converted three synthetic samples with the same converter and token count the JSON to TOON page uses. The comparison depends on the JSON you start from, so each sample was counted as formatted JSON (indented with 2 spaces) and as minified JSON (one line):

  • 100 orders with the same 5 keys: 4,291 tokens formatted, 2,387 minified, 1,571 as TOON. TOON was 63% smaller than formatted JSON and 34% smaller than minified JSON.
  • A nested settings object, five levels deep: 236 formatted, 122 minified, 153 as TOON. Smaller than formatted JSON, but 25% larger than minified JSON.
  • 30 events of three different shapes: 1,239 formatted, 644 minified, 818 as TOON. Again smaller than formatted JSON and 27% larger than minified.

Why the shape matters

TOON saves tokens by writing each key once for a whole list. When items share their keys, that removes most of the repetition. When there is no list to share keys across, as in a settings object or a mix of different records, there is nothing to remove, and the indentation TOON uses instead of braces costs about as much as the braces it replaces. Minified JSON has no indentation at all, which is why it beat TOON on those two samples.

One more comparison from the same test: the 100 orders as a plain CSV table took 1,367 tokens, fewer than TOON. For a flat table with no nesting, CSV or a Markdown table is just as good a choice; the guide on giving an AI chat a spreadsheet compares those two.

Use TOON when

A quick rule from the numbers above:

  • Use it for long lists of records with the same keys, such as API responses, exports and logs, especially when they have a few nested fields that CSV cannot hold.
  • Skip it for configuration files, deeply nested documents and lists whose items all differ; minify the JSON instead with Minify JSON.
  • Skip it for small data. Saving 50 tokens is not worth explaining a new format to the chat.

Measure your own data

Paste the JSON into JSON to TOON and it shows the token count before and after and the saving in percent. The "before" count is the JSON as you pasted it, so formatted JSON shows a bigger saving than the same data minified. For a fair test, minify it first, then convert. The counts follow one common tokenizer, so for other models they are estimates; the token counter uses the same count.

The conversion runs in your browser and nothing is sent to a server or to any AI service. If the data holds names, emails or ID numbers, hide them first with Mask data.

Will a chat understand it?

TOON is new, and not every tool knows it by name. When you paste it into ChatGPT, Claude or Gemini, say in one sentence that the data is in TOON format and that the first line lists the fields. The header line makes the rows easy to follow even for a reader who has never seen the format.

TOON is also two-way: when a chat answers in TOON, or you want your data back, choose TOON to JSON on the JSON to TOON page to turn it back into ordinary JSON.

Questions?

Write to support@openanydoc.com and describe the shape of your data and the counts you saw (no personal data).