TOON
What is TOON?
Token-Oriented Object Notation (TOON) is a compact, human-readable, schema-aware JSON format designed for LLM prompts. It's more token-efficient than JSON while maintaining readability.
Overview
Understanding the Toon format
Toon format is specifically designed for LLM (Large Language Model) prompts where token efficiency and human readability matter. It provides a compact representation of JSON data that's easier for both humans and AI models to parse.
Unlike raw JSON, Toon uses schema-aware encoding with explicit array lengths, field headers, and tabular formatting for uniform data structures. This makes it particularly efficient for representing arrays of objects with identical keys.
Key Features
- Token-efficient: More compact than JSON for LLM prompts
- Schema-aware: Explicit array lengths and field headers
- Human-readable: Clean, indented structure
- Tabular format: Optimized for uniform arrays of objects
- Self-descriptive: Array headers show structure clearly
How to read a TOON table
An array of objects that share the same fields becomes a table with a one-line header.
![The TOON table users[3]{id,name,role}: followed by three rows: 1,Ada,admin, 2,Lin,user and 3,Sam,user. Numbered markers point at the key, the item count, the field list and the rows.](/_next/image?url=%2Fimages%2Ftoon-syntax-anatomy.webp&w=3840&q=75&dpl=dpl_4LtC6VJxiBrphiPQuq25EN6Ltek1)
usersis the key: the name of the array.[3]is the number of items, so a decoder can tell when rows are missing.{id,name,role}lists the field names once, instead of in every object.- Each indented line is one item, with its values in the order of the fields.
Examples
See how JSON converts to Toon format
Example 1: Simple Object
Input (JSON):
{
"id": 1,
"name": "Alice",
"role": "admin"
}Output (Toon):
id: 1
name: Alice
role: adminExample 2: Tabular Array (Uniform Objects)
Input (JSON):
{
"items": [
{ "sku": "A1", "qty": 2, "price": 9.99 },
{ "sku": "B2", "qty": 1, "price": 14.5 }
]
}Output (Toon):
items[2]{sku,qty,price}:
A1,2,9.99
B2,1,14.5Notice the array header items[2]{sku,qty,price}: shows the length (2) and field names, making it self-descriptive.
Example 3: Nested Structure
Input (JSON):
{
"name": "Toonade",
"version": "1.0.0",
"config": {
"theme": "auto",
"language": "en"
}
}Output (Toon):
name: Toonade
version: 1.0.0
config:
theme: auto
language: enUsage
Step 1: Paste JSON
Copy and paste your JSON data into the input field on the homepage.
Step 2: Convert
Click the "Convert to Toon" button to transform your JSON into Toon format using the official @toon-format/toon SDK.
Step 3: Copy
Use the copy button to quickly copy the converted Toon output to your clipboard. Perfect for use in LLM prompts!
Best Use Cases
- LLM Prompts: More token-efficient than JSON for AI model inputs
- Uniform Arrays: Especially efficient for arrays of objects with identical keys
- Data Visualization: Clean, readable format for documentation
- Schema-Aware Data: When you need explicit structure information
Tips
- Make sure your JSON is valid before converting
- Toon format excels with uniform arrays of objects (same fields)
- For non-uniform data, Toon may use list format which is still readable
- The format uses 2-space indentation by default
- Check out the official specification for advanced features like custom delimiters