Member-only story
TOON Notation for Smarter LLM Prompts in PHP
If you are building AI-powered systems that send structured data to large language models, you know how quickly token counts grow when using JSON. Every extra brace, colon, and repeated field name silently increases your API bill.
TOON Notation offers a simple but powerful fix. It is a compact, readable format designed specifically for LLM prompts, helping developers reduce token usage dramatically while keeping structure and meaning intact.
What is TOON Notation
TOON stands for Token Oriented Object Notation.
It was designed to make structured data lightweight and LLM-friendly by removing repetitive syntax.
In short, TOON is like JSON, but optimized for token efficiency and human readability. Instead of repeating field names inside every object, TOON defines them once and then lists the corresponding values in a clean, column-like format.
JSON vs TOON Example
Here is a simple comparison.
JSON
{
"products": [
{"sku": "A123", "name": "Widget", "price": 9.99},
{"sku": "B456", "name": "Gadget", "price": 19.99}
]
}TOON
products[2]{sku,name,price}:
A123,Widget,9.99…
