What is Token-Oriented Object Notation (TOON)?
Token-Oriented Object Notation (TOON) is a modern data format optimized for Large Language Models (LLMs). It addresses the verbosity of JSON by removing redundant syntax characters (like quotes, commas, and braces) and using a tabular layout for arrays. This results in a format that consumes significantly fewer tokens while remaining human-readable.
Understanding TOON Syntax
TOON uses a clean, whitespace-sensitive syntax. Here are the key elements:
Tabular Arrays
Arrays of objects are where TOON saves the most tokens. Instead of repeating keys for every object, TOON declares the keys once in a header.
users:
[3]
{id,name,role}
1,"Alice","Admin"
2,"Bob","User"
3,"Charlie","User"[3]indicates an array with 3 items.{id,name,role}defines the keys for the objects.- Subsequent lines contain the values for each object, separated by commas.
Clean Objects
Standard objects use simple key-value pairs with indentation to show nesting.
config:
env: "production"
retries: 3
features:
logging: true
analytics: falseBenefits of Using TOON
Significant Token Savings
By eliminating repetitive keys and syntax, TOON can reduce the token count of your data by 30-60%. This directly translates to lower API costs when using models like GPT-4 or Claude.
Enhanced Context Window
LLMs have a fixed context window. Using TOON allows you to fit more data (e.g., longer search results, larger datasets) into a single prompt without hitting the limit.
Improved Model Performance
The structured, tabular nature of TOON is easy for LLMs to parse. It mimics the CSV-like or markdown-table formats that models are well-trained on, often leading to better understanding and retrieval accuracy.
Common TOON Use Cases
RAG (Retrieval-Augmented Generation)
When feeding retrieved documents or data into an LLM, converting them to TOON first allows you to include more context and reduces the cost of every query.
Large Data Exports
For exporting large lists of users, products, or logs, TOON's tabular format is much more compact than JSON lines or standard JSON arrays.
Configuration and Prompts
Writing complex system prompts or configurations in TOON can save tokens and make the prompt easier for the developer to read and edit.
Why Choose Our TOON Formatter?
- Instant Conversion: Switch between JSON and TOON in milliseconds.
- Privacy First: All processing happens in your browser. Your data never leaves your device.
- Validation: Ensure your TOON data is correctly formatted before using it.
- Free to Use: No limits, no sign-ups, just a useful tool for developers.