JSON to TOON Converter
Convert JSON to TOON and back in your browser. TOON packs the same data into fewer prompt tokens.
Your JSON or TOON is converted locally in your browser and never uploaded, but avoid pasting secrets or production data into any online tool.
Need to tidy the JSON first? Try the JSON Formatter.
About JSON to TOON
TOON, short for Token-Oriented Object Notation, is a compact way to write JSON that uses far fewer tokens in an LLM prompt. Instead of repeating every key on every record, it folds an array of objects into a single tabular block with one header row and comma-separated values underneath. This JSON to TOON converter encodes any JSON document into TOON, shows you roughly how much smaller the result is than minified JSON, and converts TOON back to pretty-printed JSON when you switch direction. It is handy whenever you paste structured data into a model, build few-shot examples, or want to trim context windows without dropping information. Everything runs in your browser, so the data you paste is processed on your device and is never uploaded.
Features
- Convert JSON to TOON and TOON back to JSON with a single direction toggle
- Live two-pane editor that re-encodes as you type
- Folds arrays of objects into compact tabular TOON blocks
- Shows a character savings estimate of TOON versus minified JSON
- Round-trips losslessly so TOON decodes back to the original JSON value
- Pretty-prints decoded JSON with 2-space indentation and JSON syntax highlighting
- Clear parse errors for both invalid JSON and malformed TOON
- Copy the output or download it as data.toon or data.json
How to use the JSON to TOON
- Keep the toggle on JSON → TOON and paste your JSON into the left pane.
- Read the TOON output on the right and check the savings estimate above it.
- Switch the toggle to TOON → JSON to decode a TOON string back to JSON.
- Copy the result or download it as data.toon or data.json.
Example
Input
{
"users": [
{ "id": 1, "name": "Ada", "role": "admin" },
{ "id": 2, "name": "Alan", "role": "author" }
]
}
Output
users[2]{id,name,role}:
1,Ada,admin
2,Alan,author
An array of objects becomes one tabular TOON block with a single header row.
Common errors & troubleshooting
- Switching to JSON → TOON shows "Invalid JSON". — TOON encoding starts from valid JSON, so fix the parse error first; keys and strings must use double quotes and there are no trailing commas.
- Decoding shows "Invalid TOON" on a tabular block. — Each data row must supply exactly as many values as the [N]{fields} header declares, and indentation must stay consistent under the header.
- The savings estimate says the TOON is larger than the JSON. — TOON saves the most on arrays of uniform objects; for a single small object or deeply nested data the overhead can make it slightly larger.
Frequently asked questions
- What is TOON?
- TOON (Token-Oriented Object Notation) is a compact, indentation-based encoding of JSON designed to use fewer tokens in LLM prompts. It expresses arrays of objects as a tabular block, a header row listing the field names followed by comma-separated value rows, instead of repeating keys on every record.
- How much smaller is TOON than JSON?
- It depends on the shape of the data. Arrays of many uniform objects shrink the most because each key is written once in the header rather than on every row; this converter shows a per-document character estimate so you can see the actual reduction for your input.
- Is converting JSON to TOON lossless?
- Yes. TOON encodes the same data as the source JSON, so this tool round-trips it: convert JSON to TOON and back and you get the original value. The TOON → JSON direction re-emits standard, pretty-printed JSON.
- When should I use TOON instead of JSON?
- Reach for TOON when you are feeding structured data into a language model and want to fit more into the context window, build few-shot examples, or cut prompt cost. For storage, APIs, and config you will usually still want plain JSON.
- Is my data sent to a server when I convert it?
- No. The JSON to TOON conversion runs entirely in your browser, so the data you paste is encoded on your device and never uploaded.
Related tools
- JSON Formatter — Beautify, minify and validate JSON with error locations.
- JSON to Code — Generate Go, Rust, Python, Java, Kotlin, C# and TypeScript types from JSON.
- JSON Flatten / Unflatten — Flatten nested JSON to dot-notation keys, or unflatten it back.
- JSON to Zod — Generate a Zod schema (TypeScript) from a JSON sample.
- YAML ↔ JSON — Convert YAML to JSON and back.
- JSON Viewer — Text + collapsible tree viewer with expand/collapse and node paths.
All ArrayKit tools