Toon logo

Toon

Free

🎒 Token-Oriented Object Notation (TOON) – Compact, human-readable, schema-aware JSON for LLM prompts. Spec, benchmarks, TypeScript SDK.

FreeFree tier
Type
Open Source

About Toon

TOON (Token-Oriented Object Notation) is a compact, human-readable encoding of the JSON data model designed specifically for LLM prompts. It achieves up to ~40% fewer tokens compared to JSON while maintaining or improving accuracy (76.4% vs 75.0% in benchmarks). TOON uses indentation instead of braces, minimizes quoting, and introduces explicit schema guardrails via [N] lengths and {fields} headers to improve parsing reliability. Uniform arrays of objects can be represented as tables that declare fields once and stream row values line by line. The spec-driven ecosystem includes TypeScript, Python, Go, Rust, and .NET SDKs, along with a CLI and playground for experimentation.

Key Features

Token-efficient – uses ~40% fewer tokens than JSON with comparable or better accuracy
Lossless round-trip with the JSON data model (objects, arrays, primitives)
LLM-friendly guardrails with explicit [N] lengths and {fields} headers
Minimal syntax using indentation and reduced quoting for readability
Tabular arrays that collapse uniform object arrays into compact tables
Multi-language ecosystem (TypeScript, Python, Go, Rust, .NET) with spec-driven implementations

Pros & Cons

Pros
  • Reduces token usage by ~40% compared to JSON in mixed-structure benchmarks
  • Achieves 76.4% accuracy (vs JSON's 75.0%) in prompt benchmarks across 4 models
  • Human-readable format with explicit schema guidance for models
  • Deterministic, lossless encoding of JSON data model
  • Open-source ecosystem with multiple language SDKs (MIT license)
Cons
  • Smaller ecosystem and community adoption compared to JSON
  • Requires specific parser support (not natively supported by general-purpose tools)

Best For

Crafting efficient prompts for large language models to reduce token costsStructured data representation for AI model inputs with improved parsing reliabilityData interchange in LLM-based pipelines where token efficiency matters

FAQ

What is TOON?
TOON (Token-Oriented Object Notation) is a compact, human-readable encoding of the JSON data model designed for LLM prompts. It reduces token usage while maintaining or improving accuracy.
How does TOON reduce token usage?
TOON uses indentation instead of braces, minimizes quoting, and collapses uniform arrays of objects into tables that declare fields once, streaming row values line by line.
What languages are supported by TOON?
TOON has spec-driven implementations in TypeScript, Python, Go, Rust, .NET, and other languages.
Is TOON compatible with JSON?
Yes, TOON encodes the same objects, arrays, and primitives as JSON with deterministic, lossless round-trips.