JSON to TOON Converter
ConvertTurn JSON into TOON for LLM prompts — and see exactly how many tokens it saves.
What is TOON (Token-Oriented Object Notation)?
TOON is a compact text format for the JSON data model, built for one job: putting structured data into prompts for large language models using as few tokens as possible. It was published as an open specification with a reference TypeScript implementation, and it has quickly become a common way to send tables of records — search results, database rows, product catalogues, logs — to a model.
It borrows two familiar ideas. Objects use indentation, like YAML: name: Ada on one line, nested fields indented beneath their parent. Arrays of objects that all share the same keys become a table, as in CSV: a header such as users[3]{id,name,role}: declares the length and the column names once, then each item is a single comma-separated row. Everything JSON can express — strings, numbers, booleans, null, nested objects, mixed arrays — has a TOON form, so nothing is lost in conversion.
Why TOON uses fewer tokens than JSON
Models are billed, and limited, by tokens, and JSON spends many of them on structure rather than data. In an array of 100 users, formatted JSON repeats every key 100 times and wraps every key and string in quotes, every record in braces, with commas and indentation between them all. Tokenizers count most of that punctuation as tokens.
TOON writes each key once, in the array header, and drops the quotes and braces that the header makes unnecessary. Strings are quoted only when they would otherwise be ambiguous — when they look like a number or boolean, or contain the delimiter or a colon. On uniform data that typically removes 30–60% of the tokens compared with formatted JSON, and a meaningful share compared with minified JSON. The token panel under the editors measures this on your own data with GPT's o200k tokenizer, so you don't have to take a typical figure on trust.
When TOON helps — and when JSON is the better choice
TOON is not smaller for every document. As a rule of thumb:
- Big win: arrays of objects with the same keys — API results, rows from SQL or a spreadsheet, event logs, embeddings metadata.
- Moderate win: configuration-style objects with a few levels of nesting, where indentation replaces braces and quotes.
- Little or no win: deeply nested data with few repeated structures, and arrays whose objects have different keys, which TOON writes as list items rather than a table.
- Use JSON when: the text must be parsed by something that only speaks JSON, or when the model needs to return output your code consumes directly — or ask for TOON and decode it with the TOON to JSON converter.
Comma, tab, or pipe: choosing a delimiter
The delimiter separates values in tables and inline arrays. Comma is the default and the most familiar. Tab often saves a few more tokens, because tokenizers rarely merge a tab with the text around it and real values seldom contain tabs, so fewer of them need quotes. Pipe is a readable compromise when your values are full of commas, such as addresses or prose.
Whichever you choose is written into each array header — [3\t] for tab, [3|] for pipe — so a decoder never has to guess. Switch between them above and watch the token count to find the cheapest option for your data.
Using TOON in LLM prompts
Paste TOON into a prompt where you would otherwise paste JSON, ideally inside a fenced code block labelled toon so the model sees clearly where the data starts and ends. Models read it without special instructions, because the array headers spell out the item count and the field names before the rows. If you want the model to answer in TOON too, show it the header you expect, and ask it to keep the [N] count accurate.
Then decode the reply with the TOON to JSON converter. Its strict length check catches a reply that was cut off mid-table, and the result can be checked against your expected structure with the JSON Schema validator.
TOON compared with CSV, YAML, and minified JSON
CSV is just as compact for a single flat table, but it has no types, no nesting, and no way to hold more than one table — use JSON to CSV when the destination is a spreadsheet. YAML shares TOON's indentation but repeats every key for every list item, so it saves far less on arrays; JSON to YAML is the right choice for config files people edit. Minified JSON, which the JSON formatter produces in one click, is the safe universal baseline: TOON is worth it when the token panel shows it beating that baseline, not just formatted JSON.
Everything in the JSON to TOON Converter
Convert JSON to TOON (Token-Oriented Object Notation) and see the real token saving, counted with GPT's tokenizer. Free, private, runs in your browser.
Real token counts
TOON, minified JSON, and formatted JSON counted with GPT's o200k tokenizer, side by side.
Tables for arrays
Arrays of objects with the same keys become one header row plus CSV-style rows.
Comma, tab, or pipe
Pick the delimiter — tab is often the fewest tokens, pipe the most readable.
Spec-compliant
Built on the reference TOON implementation, so output round-trips back to the same JSON.
Large files, locally
Upload a file or load a URL; conversion and token counting run in your browser.
Frequently asked questions
TOON (Token-Oriented Object Notation) is a compact, human-readable encoding of the JSON data model, designed for passing structured data to large language models. Objects are written with indentation, like YAML. Arrays of objects that share the same keys become a table: one header naming the fields, such as users[3]{id,name,role}:, then one comma-separated row per item. Field names are written once instead of on every record, which is where most of the token saving comes from.
It depends on the shape of the data. On arrays of uniform objects — API results, database rows, logs — TOON commonly uses 30–60% fewer tokens than formatted JSON, and less than minified JSON too. On deeply nested or irregular data the saving shrinks, and TOON can even cost more than minified JSON. That is why this tool counts tokens on your actual data rather than quoting a typical figure.
GPT's o200k_base tokenizer, used by GPT-4o, GPT-4.1, and GPT-5, via the open-source gpt-tokenizer library. Claude, Gemini, and Llama use their own tokenizers, so their exact counts differ, but the comparison between TOON and JSON holds up closely, because the saving comes from repeating fewer keys, quotes, and braces.
Yes. TOON encodes the same data model as JSON — objects, arrays, strings, numbers, booleans, and null — and the conversion round-trips: decoding the TOON gives back the same JSON value. Strings that could be misread (ones that look like numbers or booleans, or contain the delimiter or a colon) are quoted automatically. Use the TOON to JSON converter to check a round trip yourself.
Generally, yes. TOON was designed to be self-describing: an array header states the item count and column names before the rows, which gives a model the structure up front. Benchmarks published by the TOON project report retrieval accuracy on par with JSON. Still, test it on your own model and prompts before switching a production pipeline.
When the data is deeply nested with few repeated structures, when arrays hold objects with different keys, or when a downstream system must parse the text as JSON. In those cases minified JSON is often as small, and it is universally supported. TOON pays off most on large tables of similar records.
Comma is the default and the most widely recognised. Tab often produces the fewest tokens, because tokenizers rarely merge a tab with neighbouring text and values seldom contain tabs, so fewer of them need quotes. Pipe is a readable middle ground when your values contain lots of commas. The delimiter is declared in each array header, so a decoder always knows which one was used.
Yes. Click 'Load from URL', paste any public URL that returns JSON — an API endpoint, a raw GitHub file, or a CDN asset — and the content loads instantly in your browser. The request goes directly from your device; nothing passes through our servers.
No. Every operation runs entirely in your browser using client-side JavaScript. Your JSON is never uploaded, logged, or stored on any server — it never leaves your device.
Yes, completely free with no sign-up required. There are no usage limits, no watermarks, and no premium gate on any feature.
Related tools
TOON to JSON Converter
Decode TOON into standard JSON — and catch truncated or malformed model output by line.
JSON to CSV Converter
Convert JSON to CSV online — transform any JSON array or JSON format into spreadsheet-ready CSV for Excel or Sheets.
JSON to YAML Converter
Convert JSON into clean, human-friendly YAML in one click.
JSON Formatter
Beautify, minify, and repair messy JSON — even Python dicts and JS objects — into clean, valid output.