TOON Format Converter
Convert between JSON, YAML, and TOON (Token-Oriented Object Notation). TOON uses ~40% fewer tokens for LLM inputs while maintaining better accuracy.
How it works
💡 TOON is perfect for sending structured data to LLMs - it's more compact and more accurate!
Input
Output
40% Fewer Tokens
TOON reduces token usage by ~40% compared to JSON, saving API costs for LLM applications.
Better Accuracy
73.9% parsing accuracy vs JSON's 69.7% across multiple LLM models in benchmarks.
Bidirectional
Convert freely between JSON, YAML, and TOON formats with lossless round-trips.
Lightning Fast
Client-side processing with instant conversions. Your data never leaves your browser.
What is TOON?
TOON (Token-Oriented Object Notation) is a compact, human-readable encoding format designed specifically for LLM input. It represents the same JSON data model but uses significantly fewer tokens.
While developers work with JSON programmatically, TOON serves as an optimization layer when sending data to language models, where token consumption directly impacts API costs.
JSON Example
[ {"name": "Alice", "age": 30}, {"name": "Bob", "age": 25} ]TOON Equivalent
[2] {name,age} Alice 30 Bob 25Key Features
- •YAML-like indentation for nested objects and simple structures
- •CSV-style tables for uniform arrays of objects (TOON's sweet spot)
- •Explicit structure with array length declarations
[N]and field headers{field1,field2} - •Reduced syntax with minimal quoting and no braces for objects
When to Use TOON
LLM Prompts
Reduce token costs when sending structured data to GPT, Claude, or other LLMs in your applications.
Tabular Data
Perfect for uniform arrays of objects like user lists, product catalogs, or database query results.
Cost Optimization
Save 30-60% on API costs for applications making frequent LLM calls with data-heavy prompts.
Why TOON Uses Fewer Tokens
Language models bill by the token, and JSON is expensive because it repeats structure on every record. In a list of 100 users, JSON writes out "name", "age", and "role" one hundred times each, along with braces, quotes, and colons that the tokenizer counts as separate tokens. TOON declares the field names once in a header row and then streams the values like a CSV table, so the per-record overhead nearly disappears. Uniform arrays of objects, the shape most structured prompts take, are where TOON's roughly 40% token reduction comes from.
The savings are largest for tabular data and shrink for deeply nested or highly irregular structures, where TOON falls back to YAML-like indentation and looks much closer to the original. That is why TOON is best thought of as an optimization layer for the moment you hand data to a model, not a replacement for JSON in your APIs or databases. A common workflow is to keep working in JSON, convert to TOON right before building the prompt, and let the model read the more compact form. Because the two formats describe the same data model, conversions round-trip losslessly in both directions.
Everything here runs client-side in your browser using the official TOON encoder along with JSON5 and YAML parsers, so your data is never uploaded to a server. The JSON5 input mode also accepts relaxed syntax (unquoted keys, trailing commas, and comments), which is handy when you are pasting hand-written config rather than strict machine output.
Frequently Asked Questions
What is TOON format?
TOON (Token-Oriented Object Notation) is a compact text encoding that represents the same data model as JSON but uses far fewer tokens. It declares field names once in a header row and lists values in a CSV-like table, cutting the repeated keys, quotes, and braces that make JSON token-heavy when sent to language models.
When is TOON better than JSON for LLM prompts?
TOON wins most for uniform arrays of objects (user lists, product catalogs, query results, and other tabular data) where JSON repeats the same keys on every record. For that shape it typically uses about 40% fewer tokens. For deeply nested or irregular data the savings shrink, and TOON looks closer to indented YAML.
Does converting to TOON lose any data?
No. TOON describes the same data model as JSON, so conversions round-trip losslessly. You can go JSON to TOON and back, or between YAML and TOON, without changing the underlying values or structure.
Should I replace JSON with TOON in my APIs?
No. TOON is an optimization layer for the moment you send data to a model, not a replacement for JSON in your code, APIs, or databases. A typical workflow keeps everything in JSON and converts to TOON only when building the prompt.
Is my data uploaded when I use this converter?
No. All conversion runs entirely in your browser using the official TOON encoder plus JSON5 and YAML parsers. Nothing you paste is sent to a server, so it is safe to use with private or sensitive data.
What is the JSON5 input mode for?
The JSON input accepts relaxed JSON5 syntax: unquoted keys, trailing commas, single quotes, and comments. This makes it easy to paste hand-written config or loosely formatted JSON without first cleaning it up into strict form.
Discussion
Start the conversation
Leave a comment
Loading comments...