JSON ⇄ TOON Converter
How it works
Paste JSON and get TOON, Token-Oriented Object Notation: a compact, human-readable encoding of the same data designed to burn fewer LLM tokens. The conversion is lossless, so flipping the direction decodes the TOON back to identical JSON. A live counter shows the estimated token saving as you type.
Why does it save tokens? JSON repeats itself: every object in an array re-states every key, and every string is wrapped in quotes with braces and commas everywhere. TOON removes the redundancy. An array of uniform objects becomes a table: the keys are declared once in a header (`users[2]{id,name,role}:`), then each object is one comma-separated row. Nesting uses indentation instead of braces, and quotes appear only where they are actually needed. On typical structured payloads (API responses, database exports, product catalogues) that is 30-60% fewer tokens, which translates directly into lower API bills and more room in the context window.
The format is schema-aware in a way that also helps the model: the `[2]` length marker and the `{id,name,role}` field list tell the LLM how many rows to expect and what each column means. Benchmarks by the TOON project show models parse it as reliably as JSON, sometimes better, precisely because the structure is declared up front.
When should you not use TOON? Deeply nested, non-uniform data (config trees, GraphQL-ish shapes) compresses poorly, and TOON is sometimes even slightly larger; the live counter turns negative to warn you. It is also a prompt-side format: ask the model to answer in JSON if your pipeline parses the response. This tool uses the official @toon-format reference implementation and runs entirely in your browser, so nothing you paste is uploaded. Pair it with the LLM Token Calculator on this site to measure the exact token cost of the result per model.
Frequently Asked Questions
What is TOON?
- Token-Oriented Object Notation, an open serialization format (toonformat.dev) that encodes the same data model as JSON with far fewer tokens. Keys of uniform object arrays are declared once as a table header, nesting is indentation-based, and quoting is minimal. It was designed in 2025 specifically for passing structured data to LLMs.
How much does TOON actually save?
- 30-60% on arrays of uniform flat objects, which is the common case: query results, CSV-like data, product lists. Deeply nested or highly irregular structures save little and can even cost slightly more. The live token counter above the output shows the real number for your data, including a negative one.
Is the conversion lossless?
- Yes. TOON encodes the exact JSON data model: objects, arrays, strings, numbers, booleans, null. Encode then decode returns deeply-equal JSON. This tool uses the official @toon-format/toon reference implementation, so the output matches the spec.
Do LLMs actually understand TOON?
- Yes. The TOON project's retrieval benchmarks across GPT, Claude and Gemini models show accuracy on par with JSON, better in several tests, because the explicit `[N]` row counts and `{field}` headers give the model the schema up front. For maximum safety, include the one-line hint 'The data below is in TOON format (indentation-based, tabular arrays)' in your prompt.
Should I ask the model to reply in TOON too?
- Usually no. TOON shines on the input side, where you control the encoding. Model output is better requested as JSON if a program parses it: every SDK has a JSON mode, and models are heavily trained to emit valid JSON. Use TOON to feed data in, JSON to get data out.
Is my data uploaded anywhere?
- No. The encoder and decoder run entirely in your browser tab, with no backend and no logging. You can confirm from DevTools → Network: converting produces zero outbound requests. Safe for API payloads and internal data.
JSON vs TOON: the same data, side by side
A two-record employee list. JSON repeats every key per object; TOON declares the schema once and streams rows.
| Format | Encoding | Est. tokens |
|---|---|---|
| JSON (minified) | {"staff":[{"id":1,"name":"Ada","role":"admin"},{"id":2,"name":"Alan","role":"user"}]} | ~30 |
| TOON | staff[2]{id,name,role}: 1,Ada,admin 2,Alan,user | ~17 |
Token estimates via GPT-style BPE. Savings grow with the number of rows: the header cost is paid once.