TOON (Token-Oriented Object Notation) is a compact data serialization format designed to reduce token costs when passing structured data to Large Language Models. It combines YAML-style indentation with CSV-like tabular formatting to achieve 30-60% token savings compared to JSON while maintaining human readability. The format uses explicit length markers and field headers to help LLMs validate output, supports multiple delimiters (comma, tab, pipe), and includes a JavaScript implementation with encoding capabilities. Benchmarks show TOON achieves 86.6% accuracy in LLM retrieval tasks while using 46.3% fewer tokens than JSON across models like GPT-5, Claude, and Gemini.
Table of contents
Why TOON?Format ComparisonKey FeaturesBenchmarksInstallationQuick StartCanonical Formatting RulesFormat OverviewType ConversionsAPIUsing TOON in LLM PromptsNotes and LimitationsQuick ReferencePorts in Other LanguagesLicenseSort: