Key takeaways
- On a 20-row product list, TOON used 373 tokens against 555 for minified JSON, 32.8% fewer.
- TOON saves the most on arrays of objects that share the same keys, because the keys are written once as a header row.
- Deeply nested data with no repeated rows can be slightly larger than minified JSON (6.3% more in our test), so check the count first.
- Conversion is lossless for JSON data: decoding the TOON gives back exactly the same values.
How to use the JSON to TOON Converter
- 1Paste your JSON into the left box. An example product list is already there.
- 2Pick a delimiter. Comma is the default; tab often saves a few more tokens, and pipe suits data full of commas.
- 3Copy the TOON from the right box and check the token counts underneath.
- 4To go back, switch to TOON → JSON. The current output moves into the input box for you.
What is TOON?
TOON (Token-Oriented Object Notation) is a compact, human-readable text format that stores the same data as JSON in fewer tokens. It uses indentation instead of braces for nesting, like YAML, and writes arrays of similar objects as a table: the field names once in a header, then one line per row.
For example, a list of three users becomes four short lines. The header users[3]{id,name,role,active}: says there are 3 rows with those 4 fields, and each row follows as comma-separated values such as 1,Alice,admin,true. In JSON the same data repeats every key in quotes for every row, which is where the extra tokens come from. You can count tokens for any text with our AI token counter.
How does TOON reduce tokens?
Language models read text as tokens, and JSON spends many of them on punctuation and repeated keys: quotes, braces, brackets, colons and the same field names on every row. TOON removes most of that. Keys in a table appear once, strings only need quotes when they contain special characters, and nesting is shown with two-space indentation.
TOON also adds a little structure that JSON lacks: each array declares its length in square brackets. That helps a model notice when rows are missing and lets the decoder check that nothing was cut off. In this converter, TOON → JSON uses strict checking, so a wrong row count shows a clear error.
When should you use TOON instead of JSON?
Use TOON when you paste structured data into a prompt and the data is mostly lists of similar records: product catalogs, search results, log lines, spreadsheet exports or database rows. These are exactly the cases where it saves a third or more of the tokens compared with minified JSON.
Keep JSON for APIs, configuration files and anything a program will parse, because nearly every tool expects it. Deeply nested objects with few repeated rows gain little and can even grow slightly. A practical pattern is to send data to the model as TOON, ask for the reply in JSON, and validate that reply with our JSON formatter. To pin down the reply format, generate a schema with the JSON Schema generator.
Do ChatGPT and Claude understand TOON?
Large language models generally read TOON well, because it combines patterns they have seen countless times: CSV-style rows and YAML-style indentation. Results still vary by model and task, so test accuracy on a few of your own prompts before switching a production workflow.
It helps to add one sentence before the data, such as "The data below is in TOON format: users[3]{id,name} means 3 rows with fields id and name." If you are comparing two prompt versions, our text compare tool shows exactly what changed between them.
Worked example
A 20-row product list in JSON and TOON
Take a list of 20 products, each with a SKU, name, price, stock level and category. Formatted JSON with two-space indentation comes to 939 tokens with the GPT-4o tokenizer. Removing the whitespace (minified JSON) brings it down to 555 tokens.
The same data in TOON with commas is 373 tokens: 32.8% fewer than minified JSON and 60.3% fewer than formatted JSON. Switching the delimiter to tab trims it further to 352 tokens. Sent 1,000 times, the comma version saves 182,000 input tokens compared with minified JSON.
A small nested object behaves differently. An order with a customer and an address, but no repeated rows, is 48 tokens as minified JSON and 51 as TOON, so here JSON is the more compact choice. The converter shows both numbers, so you can decide for each dataset.
Token counts for three sample datasets
Counted with the GPT-4o tokenizer (o200k_base). TOON uses the default comma delimiter. Other tokenizers give slightly different numbers, but the pattern is the same.
| Dataset | Formatted JSON | Minified JSON | TOON | TOON vs minified |
|---|---|---|---|---|
| 3 users (table) | 102 | 53 | 36 | 32.1% fewer |
| 20 products (table) | 939 | 555 | 373 | 32.8% fewer |
| 1 nested order | 83 | 48 | 51 | 6.3% more |
The 3-user table in TOON looks like this: users[3]{id,name,role,active}: / 1,Alice,admin,true / 2,Bob,user,false / 3,Chen,user,true
TOON syntax at a glance
How common JSON patterns look after conversion. The TOON column is produced by the same library this tool uses.
| JSON | TOON |
|---|---|
| {"name":"Ada","age":36} | name: Ada / age: 36 |
| {"user":{"city":"Lahore"}} | user: / city: Lahore |
| {"tags":["ai","json","llm"]} | tags[3]: ai,json,llm |
| {"items":[{"id":1,"qty":2},{"id":2,"qty":5}]} | items[2]{id,qty}: / 1,2 / 2,5 |
| {"note":"a, b"} | note: "a, b" |
A slash ( / ) marks a new line. Strings are quoted only when they contain a delimiter, a colon or other special characters.
Frequently asked questions
Is TOON better than JSON?
For sending table-like data to a language model, usually yes: TOON carries the same information in roughly a third fewer tokens than minified JSON, which lowers cost and leaves more room in the context window. For APIs, config files and nested documents JSON remains the better choice, because every tool supports it and TOON saves little on deeply nested data.
Is converting JSON to TOON lossless?
Yes. TOON represents the same values JSON can hold: objects, arrays, strings, numbers, true, false and null. Decoding the TOON gives back data identical to the original JSON, with keys in the same order. Only formatting such as whitespace is not preserved, exactly as when you minify JSON.
How many tokens does TOON save?
It depends on the shape of the data. In our tests with the GPT-4o tokenizer, a 20-row product list was 32.8% smaller than minified JSON and 60.3% smaller than formatted JSON, while a small nested object was 6.3% larger. Paste your own data into the converter to see the exact numbers.
Which TOON delimiter should I use?
Start with the comma, which is the default and the easiest to read. Tab often saves a few more tokens (352 instead of 373 on the 20-product example) because tabs rarely appear in data. Choose pipe when your values contain many commas, such as addresses or descriptions, so fewer strings need quotes.
Can I convert TOON back to JSON?
Yes. Choose TOON → JSON and paste the TOON text. The converter checks that each array has the number of rows its header declares and that every row has the right number of fields, then returns formatted JSON. If something does not match, you get an error message explaining the problem.
Is my data uploaded anywhere?
No. The conversion and the token counting both run in your browser, so the data you paste never leaves your device. That makes the tool safe for customer lists, logs and other private data. To see what the saved tokens are worth, run your numbers through the AI API cost calculator. You will find more tools for working with language models in our AI tools section.
Sources
- TOON: Specification (Token-Oriented Object Notation)
- TOON: Getting started
- OpenAI Cookbook: How to count tokens with tiktoken
Last reviewed by the ToolsFiesta team.