JSON ↔ TOON

Your data never leaves your browser

Convert 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.

Input - JSON
Output - TOON
Ctrl+Shift+CCopyCtrl+KClearTOON is lossless - JSON → TOON → JSON produces identical output

Share this tool

Found it useful? Help a fellow developer discover it.

https://developertoolkit.dev/tools/json-to-toon

How TOON compares to JSON

FormatTokens (mixed)LLM AccuracyBest for
TOON2,74473.9%Uniform arrays of objects
JSON compact3,08170.7%General-purpose API data
YAML3,71969.0%Human-readable configs
JSON4,54569.7%Standard pretty-printed JSON
XML5,16767.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

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-4, Claude, Gemini, and Llama 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