.toon · text/plain
TOON: Token-Oriented Object Notation
TOON combines YAML-like indentation for nested objects with CSV-like tabular headers (`items[N]{col1,col2}:`) to eliminate repeated JSON keys in LLM prompts.
Quick Answer: TOON combines YAML-like indentation for nested objects with CSV-like tabular headers (`items[N]{col1,col2}:`) to eliminate repeated JSON keys in LLM prompts. Cutting LLM prompt token costs by 30–60% when sending uniform JSON object arrays to GPT-5, Claude 4, or Gemini.
| Structure type | Hierarchical |
|---|---|
| Human readability | High |
| Nesting support | Yes |
| LLM token efficiency | High |
| File extension | .toon |
| MIME type | text/plain |
| Best for | Cutting LLM prompt token costs by 30–60% when sending uniform JSON object arrays to GPT-5, Claude 4, or Gemini. |
Strengths
- Cuts LLM input token consumption by 30%–60% on structured record arrays
- Preserves explicit array lengths and field headers so LLMs stay accurate
- Losslessly round-trips back to typed JSON via @toon-format/toon
Trade-offs
- Newer format not natively parsed by standard browser JSON APIs
- Deeply irregular schemas with shifting keys save fewer tokens than uniform arrays
- Requires encoding/decoding step at LLM input/output boundaries
References
Convert & clean TOON locally
Related engineering guides
- TOON vs JSON: Cutting LLM Prompt Token Cost by 30–60%See how Token-Oriented Object Notation (TOON) eliminates repeated JSON keys in uniform arrays to cut GPT-5, Claude 4, and Gemini 2.5 prompt costs.
- Building Valid JSONL Fine-Tuning Datasets from CSV & JSONFormat valid OpenAI chat, Alpaca, and Gemini fine-tuning .jsonl files from spreadsheets and JSON arrays locally with per-line validation.
- Preparing PDF, Word & Excel as Clean Markdown for RAG & LLMsTurn confidential PDFs, Word DOCX docs, and Excel sheets into structured Markdown for vector chunking and LLM context—100% locally.
- Generating TypeScript, Zod & Pydantic v2 Schemas from JSONTurn API JSON samples into strict TypeScript interfaces, runtime Zod validators, and Python Pydantic v2 BaseModels with optional & alias inference.
Related Formats
All 24 formatsTOON frequently asked questions
How much does TOON reduce LLM token counts compared to JSON?
On uniform arrays of objects (database rows, API lists, catalog items), TOON typically reduces tokens by 35% to 60% by declaring keys once in the header.
Does TOON lose data types when converting back to JSON?
No. Strings, numbers, booleans, nulls, nested objects, and arrays round-trip accurately back into JSON.
Which delimiter works best inside TOON tabular blocks?
Comma is standard and human-friendly; tab (\t) or pipe (|) can save a few extra tokens in o200k_base when values contain spaces or commas.