JSON ↔ TOON
Your data never leaves your browserConvert JSON to TOON format to cut LLM prompt tokens by ~40%. TOON achieves higher LLM accuracy on the same data with fewer tokens. Lossless and bidirectional.
Share this tool
Found it useful? Help a fellow developer discover it.
Convert in the other direction
Going the other way, turning a TOON block from an LLM response back into JSON?
Convert TOON to JSON
How TOON compares to JSON
| Format | Tokens (mixed) | LLM Accuracy | Best for |
|---|---|---|---|
| TOON | 2,744 | 73.9% | Uniform arrays of objects |
| JSON compact | 3,081 | 70.7% | General-purpose API data |
| YAML | 3,719 | 69.0% | Human-readable configs |
| JSON | 4,545 | 69.7% | Standard pretty-printed JSON |
| XML | 5,167 | 67.1% | Legacy / SOAP systems |
Benchmark data from the TOON spec across 209 retrieval questions on 4 LLM models.
What is TOON?
TOON (Token-Oriented Object Notation) is a compact, lossless encoding of the JSON data model designed for LLM input. It combines YAML-style indentation for nested objects with CSV-style tabular layout for uniform arrays of objects. This means a 100-row array of employee records where every row has the same fields is encoded as a header line followed by comma-separated rows, rather than repeating the field names 100 times as JSON does. The result is approximately 40% fewer tokens with no loss of information. The conversion is lossless: JSON → TOON → JSON produces identical output. TOON's sweet spot is uniform arrays of objects. For deeply nested or non-uniform JSON, the tool will show an advisory.
When TOON works best
- Large arrays of uniform objects. Database query results, CSV exports loaded as JSON, and API responses where every row shares the same schema. TOON collapses repeated key names into a single header row, cutting tokens by 30 to 50 percent.
- RAG and retrieval contexts. When injecting a retrieved dataset into an LLM prompt, TOON reduces the context footprint without losing any data. More records fit within a fixed token budget.
- Classification and extraction tasks. Feeding product catalogues, employee records, or transaction logs to an LLM. TOON's tabular layout matches how LLMs are trained to read tabular data.
- Reducing API costs. LLM APIs charge per token. If you send the same large JSON payload across many calls, converting it to TOON once can reduce input token costs by 30 to 40 percent.
- Not for deeply nested configs. TOON does not compress nested objects or non-uniform arrays. For Kubernetes manifests, OpenAPI specs, or irregular JSON, compact JSON is already near optimal.
Frequently Asked Questions
Is TOON lossless?
Yes. TOON encodes the same data model as JSON: strings, numbers, booleans, null, arrays, and objects. The conversion is fully lossless, running JSON → TOON → JSON produces byte-for-byte identical output.
When does TOON NOT help?
TOON is most beneficial for uniform arrays of objects (same fields across all rows). For deeply nested configs, non-uniform structures, or single objects with no arrays, the token savings are minimal or negative. The tool will display an advisory in those cases.
Which LLMs support TOON input?
Any LLM that can process text can read TOON. No special model support is required. TOON is a text format. Benchmarks show it works well across GPT, Claude, Gemini, and DeepSeek model families.
Can I use TOON in my application?
Yes. The @toon-format/toon npm package is browser-compatible and MIT licensed. Install it with npm install @toon-format/toon. This tool uses that same package for all conversions.
Why does the tool show a "may not benefit" advisory?
TOON's tabular format is only applied to uniform arrays, meaning arrays where every object has the same set of keys with primitive values. For JSON that is mostly nested objects or irregular arrays, TOON falls back to YAML-style indentation, which may not be significantly smaller than compact JSON.
How much token reduction can I expect from TOON?
Benchmarks across 4 LLM models show TOON uses approximately 40% fewer tokens than pretty-printed JSON and about 11% fewer than compact (minified) JSON when applied to uniform arrays of objects. For deeply nested or non-uniform JSON the reduction is smaller or negligible. The tool shows a live token count comparison when you convert.
How do I convert JSON to TOON online?
Paste your JSON into the input panel and the TOON output appears instantly on the right. The tool automatically detects uniform arrays and applies tabular encoding where beneficial. Click Copy to copy the TOON output or Download to save it as a file. To convert back, toggle the direction to TOON to JSON.
Is TOON an open standard?
TOON is an open format. The specification and reference implementation are published under an open license. The npm package @toon-format/toon is MIT licensed and browser-compatible. This tool uses that same package for all conversions, so the output is identical to what you would get programmatically in your own application.
Related Tools
TOON to JSON Converter
Convert TOON (Token-Oriented Object Notation) back to JSON. Decode a compact LLM response into standard JSON. Lossless and instant.
JSON Formatter & Validator
Format, beautify, validate, and minify JSON. Detects BigInt precision issues, duplicate keys, and JSONC comments.
AI Token Counter
Count tokens for GPT-5.6, Claude, Gemini, DeepSeek, and GLM. See context window usage and estimated API cost.
JSON Diff
Compare two JSON objects side-by-side and highlight differences.
From the Blog
The Browser Tools Every Developer Actually Needs in 2026
A no-fluff guide to browser tools developers actually reach for. JSON formatters, JWT decoders, regex testers, and more. Privacy-first, no sign-up.
Read article