What is TOON?
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
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