JSON → TOON Converter
Reduce LLM token usage by 30–60%.
TOON (Token-Oriented Object Notation) condenses JSON by eliminating repeated keys, braces, and quotes — saving real API cost on every call to GPT-4, Claude, or Gemini.
Invalid JSON
// Output will appear here…
Conversion Options
Key Folding
Collapses arrays of objects into field-per-row format — the biggest token saver.
Indent Spaces
Indentation depth used for nested structure.
Value Delimiter
Separator between values in key-folded rows. Use pipe if values contain commas.
Why use TOON?
Paste TOON instead of JSON in your LLM prompt — same structured data, fraction of the cost.
GPT
compatible
Claude
compatible
Gemini
compatible
At $5/M tokens, cutting 50% on a 1K-token call saves $2.50 per 1 000 requests — that compounds fast at scale.
TOON Quick Reference
key: value
← simple key-value pair
tags[3]: js, json, llm
← inline primitive array
users[2]:
id: 1, 2
name: Alice, Bob
← key-folded object array
address:
city: Austin
← nested object (indentation)
How TOON Reduces Tokens
Key Folding
Arrays of same-key objects have keys listed once, then all values on their own row. Eliminates one key per object per field.
No Punctuation Noise
Curly braces { }, square brackets, and most double quotes are dropped. Each saves a token.
Colon Shorthand
Nested depth is shown by indentation, not nested { } blocks. Colons separate keys from values directly.
JSON (156 tokens)
TOON (68 tokens — 56% smaller)
What is TOON (Token-Oriented Object Notation)?
TOON is a compact text format for representing structured data with fewer tokens than JSON. It was designed specifically for use cases where you need to pass large amounts of structured data to large language models (LLMs) like GPT-4o, Claude 3.5, or Gemini 1.5, and want to minimize the token cost of every API call.
Unlike JSON — which was optimized for machine parsing and human readability — TOON is optimized for token efficiency. It strips out redundant delimiters, quotes, and repeated key names while preserving all the information an LLM needs to understand the data structure.
When Should You Use TOON?
- Database query results — tabular data with many rows and fixed columns is where key folding saves the most.
- API payloads — when your system prompt includes dynamic JSON from a REST API, TOON reduces prompt size significantly.
- Batch processing — sending many records to an LLM for classification, extraction, or transformation.
- Context window optimization — when you are hitting the context limit and need to fit more data into one request.
- Cost reduction — since most LLM APIs charge per token, smaller prompts directly lower your bill.
TOON Format Rules
Simple objects
Each key-value pair is written as key: value on its own line. No braces, no commas between pairs. Nesting is shown by indentation.
Arrays of primitives
Written as key[n]: v1, v2, v3 where n is the item count and values are comma-separated on one line.
Arrays of objects (key folding)
When all objects share the same keys (like a database result), TOON uses key folding: key[n]: on the first line, then each field gets its own row with all n values separated by the chosen delimiter. This is TOON's biggest token saver.
String quoting
Strings are left unquoted unless they are empty, contain the delimiter character, contain newlines, or could be misread as a number or boolean. This alone removes thousands of quote characters from large payloads.
Do LLMs Understand TOON?
Yes. Modern LLMs understand structured text with line-based key-value notation very well — it closely resembles YAML, INI files, and tabular text formats they have seen extensively in training data. You can instruct the model in your system prompt that the data is in TOON format, or simply provide a brief description. In practice, well-structured TOON requires minimal explanation.
Comparison: JSON vs TOON Token Usage
| Data Type | JSON tokens | TOON tokens | Savings |
|---|---|---|---|
| Simple object (6 fields) | ~48 | ~35 | 27% |
| Array of 4 objects (5 fields) | ~156 | ~68 | 56% |
| Nested e-commerce order | ~210 | ~130 | 38% |
| Product catalog (5 products, 7 fields) | ~280 | ~115 | 59% |
| Analytics with 4 arrays | ~480 | ~210 | 56% |
Frequently Asked Questions
What is TOON format?
TOON stands for Token-Oriented Object Notation. It is a compact text format designed to represent structured data (like JSON) using fewer tokens when passed to large language models such as GPT-4, Claude, or Gemini. It achieves 30–60% token reduction by eliminating redundant syntax like repeated object keys, curly braces, and quotation marks.
How much does TOON reduce token usage?
Typically 30–60%. Arrays of objects benefit the most from key folding — the bigger and more uniform the array, the higher the savings. Simple scalar objects see 15–25% reduction, while large tabular datasets can exceed 60%.
Can I convert TOON back to JSON?
Yes — click the ⇄ Swap button to enable TOON → JSON mode. Paste your TOON text in the left panel and the tool will parse it back to valid JSON. The parser handles key-folded arrays, nested objects, and primitive arrays.
Is my data sent to any server?
No. All conversion happens 100% in your browser using JavaScript. Your JSON data never leaves your device — there are no server requests, no logging, and no data collection.
What is key folding?
Key folding is TOON's most powerful feature. When you have an array of objects that all share the same keys (like a database result set), instead of repeating the key names in every object, TOON lists each key once and then all its values in one comma-separated row. For example: users[3]: followed by name: Alice, Bob, Carol. You can disable it in Options if you prefer per-item formatting.
Which delimiter should I choose?
Comma is the default and works for most data. Use Pipe (|) if your data values themselves contain commas (like addresses or product names with sizes). Use Tab if you want TSV-compatible output that can be pasted directly into a spreadsheet.