JSON is too chatty for LLMs. TOON cuts the bill.
It re-encodes JSON into a token-cheaper, schema-explicit format so you can fit more context into LLM prompts without losing structure.

What it does
TOON is a lossless serialization format that represents the same data model as JSON—objects, arrays, primitives—but strips the syntactic bloat. It uses indentation for nested objects and collapses uniform arrays into tabular blocks with explicit length declarations and field headers. You keep JSON in your code and translate to TOON at the LLM boundary.
The interesting bit
The format treats token efficiency as a first-class constraint rather than an afterthought. By declaring array shapes up front with headers like hikes[3]{id,name,...}, it gives models a schema anchor that the authors claim improves parsing reliability while approaching CSV-level compactness.
Key highlights
- Benchmarks across four models show 76.4% retrieval accuracy (vs. JSON’s 75.0%) using roughly 40% fewer tokens on mixed-structure datasets.
- Deterministic round-trips: encode JSON to TOON for the prompt, decode back to the same JSON data model.
- Multi-language ecosystem with spec-driven implementations in TypeScript, Python, Go, Rust, and .NET.
- Explicit array lengths and field lists act as guardrails, which the project calls “LLM-friendly” schema hints.
- Flat tabular data incurs a 5–10% overhead over CSV in exchange for structural metadata.
Caveats
- Deeply nested or non-uniform structures often cost more tokens in TOON than in compact JSON; the README is upfront that JSON wins when tabular eligibility drops near zero.
- Some local or quantized models may process compact JSON faster despite TOON’s lower token count, so latency-critical paths need their own benchmarks.
- The format is described as “stable, but also an idea in progress,” so the spec may still shift.
Verdict
Worth a look if you’re stuffing large uniform datasets into context windows and paying per token. Skip it if your data is deeply nested, already flat enough for CSV, or if you’re running latency-sensitive local inference where JSON parsing overhead beats token savings.
Frequently asked
- What is toon-format/toon?
- It re-encodes JSON into a token-cheaper, schema-explicit format so you can fit more context into LLM prompts without losing structure.
- Is toon open source?
- Yes — toon-format/toon is open source, released under the MIT license.
- What language is toon written in?
- toon-format/toon is primarily written in TypeScript.
- How popular is toon?
- toon-format/toon has 25k stars on GitHub and is currently accelerating.
- Where can I find toon?
- toon-format/toon is on GitHub at https://github.com/toon-format/toon.