.toontext/plainLLM & Streaming FormatsToken-Oriented Object Notation (TOON)
Shrinking LLM prompt payloads, RAG context tables, and agent tool responses by 30%–60% tokens without losing JSON data fidelity.
TOON (Token-Oriented Object Notation) is a lossless, human-readable data serialization built for LLMs that folds uniform object arrays into schema-declared tabular blocks with explicit row counts.
| Property | TOON |
|---|---|
| File extension | .toon |
| MIME type | text/plain |
| Structure type | Hierarchical |
| Encoding | UTF-8 Text |
| Nesting support | Yes |
| LLM token efficiency | High |
| Schema / typed | Yes |
| Best for | Shrinking LLM prompt payloads, RAG context tables, and agent tool responses by 30%–60% tokens without losing JSON data fidelity. |
Strengths
- Cuts GPT-4o / Claude / Gemini prompt tokens by 35%–60% on uniform arrays of objects
- Declares explicit array lengths and field headers (
users[3]{id,name}:) to improve LLM parsing accuracy - 100% lossless round-trip conversion back to typed JSON booleans, numbers, nulls, and nested objects
Trade-offs
- Newer format requiring conversion back to JSON if downstream consumers expect standard REST JSON
- Deeply irregular, non-uniform nested objects see smaller token gains than flat or tabular records
- Strict array-length checks reject truncated payloads unless strict mode is disabled
Convert & inspect TOON locally
Shrink JSON arrays into Token-Oriented Object Notation (TOON) to cut GPT-4o and Claude prompt tokens up to 60%.
TOON to JSONDecode Token-Oriented Object Notation (.toon) into formatted, strictly typed JSON arrays and objects in RAM.
CSV to TOONTransform CSV or TSV spreadsheets into schema-declared TOON blocks with typed numbers and booleans for LLM prompts.
YAML to TOONCompress Kubernetes manifests, OpenAPI specs, and YAML configs into compact TOON for ~42% smaller LLM prompt payloads.
Related engineering guides
Compare GPT-4o o200k_base BPE token counts across formatted JSON, minified JSON, YAML, CSV, and TOON—plus how TOON cuts prompt array tokens 40%–60%.
How to Repair Malformed & Truncated LLM JSON Outputs LocallyAutomatically strip markdown code fences, fix single quotes, trailing commas, Python True/False literals, and truncated brackets from LLM JSON responses.
Offline LLM BPE Token Counting & Prompt Cost Optimization GuideCount exact o200k_base and cl100k_base BPE tokens offline, visualize token boundary segments, prune null JSON fields, and cut prompt API costs locally.
Related Comparisons
TOON frequently asked questions
Is TOON lossless when converting back to JSON?
Yes. TOON preserves strings, numbers, booleans, nulls, nested objects, and arrays identically through the official @toon-format/toon specification.
How much cheaper is TOON than JSON in GPT-4o prompts?
Uniform arrays like user lists, order tables, or search results typically drop 40%–60% in o200k_base BPE tokens compared to formatted JSON.
Can I convert CSV or YAML straight to TOON?
Yes. DataTo converts JSON, CSV/TSV, and YAML directly into TOON in browser RAM and shows live GPT-4o BPE token savings.