How to convert JSON to TOON
- Paste JSON or open a file. The TOON output and an estimate of the tokens saved appear immediately.
- Choose the delimiter: comma (default), tab or pipe. Tabs often need even fewer tokens.
- Copy the TOON into your prompt. To read a model's TOON answer, switch the direction to TOON → JSON.
TOON vs JSON: an example
The same two users in JSON:
{"users":[{"id":1,"name":"Ada","role":"admin"},{"id":2,"name":"Bob","role":"user"}]}
and in TOON:
users[2]{id,name,role}:1,Ada,admin2,Bob,user
The field names are written once in the header instead of once per object, and the quotes, braces and most punctuation disappear. For uniform arrays of objects – database rows, logs, search results, product lists – the savings are large: in our test with 100 customer records, TOON needed about 65% fewer tokens than formatted JSON and 47% fewer than minified JSON. The [2] length marker also lets the model and the decoder check that no row is missing.
TOON format in brief
| Data | TOON |
|---|---|
| Object field | name: Ada |
| Nested object | address: followed by indented fields |
| Array of plain values | tags[3]: red,green,blue |
| Array of objects with the same keys | users[2]{id,name}: followed by one row per object |
| Mixed or nested arrays | items[2]: followed by - list items |
| Strings | unquoted, unless they contain the delimiter, a colon, quotes or brackets, have spaces at the ends or look like a number, true, false or null |
When JSON is still the better choice
- Deeply nested or irregular data – when objects have different keys or contain nested objects, TOON falls back to indented lists and the savings shrink or disappear. With 20 records that each contained a nested address and a tag list, TOON was still 34% smaller than formatted JSON but 12% larger than minified JSON. The converter shows both comparisons for your data.
- Machine interfaces – APIs, function calling and structured outputs expect JSON.
- Model familiarity – language models have seen far more JSON than TOON; check the answer quality on your own prompts before switching.
- Tiny payloads – for a handful of values the difference is negligible.
Token counts are estimated as characters ÷ 4. Exact numbers depend on your model's tokenizer, but the relative difference is a good guide.
Frequently asked questions
What is TOON?
TOON (Token-Oriented Object Notation) is a compact, human-readable encoding of the JSON data model designed for LLM prompts. It combines YAML-style indentation for objects with CSV-style rows for uniform arrays.
Is TOON better than JSON?
For sending tabular or uniform data to a language model, usually yes: fewer tokens and explicit array lengths. For APIs, storage and deeply nested data, JSON remains the better choice.
How are the tokens estimated?
The tool divides the number of characters by four, a common rule of thumb for English text and code. The exact count depends on the tokenizer of your model.
Can I convert TOON back to JSON?
Yes. Switch the direction to TOON → JSON; the decoder checks the declared array lengths and reports the line of any problem.