toon
TOON is a compact, human-readable data format optimized for LLM input that encodes JSON data using CSV-style tables for arrays and YAML-like indentation for objects. It claims ~40% token reduction versus JSON on mixed structures while maintaining lossless round-trip conversion, backed by benchmarks showing 76.4% vs 75.0% accuracy on retrieval tasks.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | toon-format/toon |
| Owner | toon-format |
| Primary language | TypeScript |
| License | MIT — OSI-approved |
| Stars | 24.8k |
| Forks | 1.1k |
| Open issues | 20 |
| Latest release | v2.3.0 (2026-05-20) |
| Last updated | 2026-06-12 |
| Source | https://github.com/toon-format/toon |
What toon is
TOON combines indentation-based nesting (YAML-style) with tabular array representation (CSV-style), using explicit length declarations [N] and field headers {fields} to signal schema. The format is deterministic, lossless, and spec-driven (v3.3); TypeScript SDK available via npm with CI/CD validation. Best suited for uniform arrays of objects with primitive fields; degrades for deeply nested or non-uniform structures.
Get the toon source
Clone the repository and explore it locally.
git clone https://github.com/toon-format/toon.gitcd toon# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Benchmark your exact data shape and LLM (gpt-4, Claude, Llama, etc.) empirically; token savings vary by structure (0–60% depending on tabular eligibility) and model tokenizer.
- TypeScript SDK available via npm (@toon-format/toon); verify Go, Python, Rust implementations in ecosystem match v3.3 spec and are actively maintained if multi-language support required.
- Encode JSON to TOON before sending to LLM; decode LLM responses back to JSON if your system expects JSON downstream. Benchmark end-to-end latency, not just token count.
- TOON format is 'stable but an idea in progress' (README); spec may evolve. Pin your SDK version and test upgrades; community-driven (GitHub spec repo), not maintained by a commercial vendor.
- For semi-uniform or non-uniform arrays (40–60% tabular eligibility), token savings diminish; evaluate cost/benefit carefully and consider fallback to JSON if conversion overhead exceeds savings.
When to avoid it — and what to weigh
- Deeply nested or highly non-uniform JSON structures — TOON's tabular compaction applies only to uniform arrays. Complex configuration objects or variable-schema data may see negligible or negative token savings; JSON remains more efficient.
- Pure flat tabular data (no nesting required) — CSV is more compact than TOON for simple tables. TOON adds 5–10% overhead (length declarations, field headers) that benefit LLMs but waste tokens for dumb parsers or pure tabular contexts.
- Latency-critical real-time applications — If end-to-end inference time is the bottleneck, benchmark empirically. Some quantized or local models (Ollama) may parse compact JSON faster than TOON despite lower token count; measure TTFT on your exact setup.
- Non-LLM-based systems expecting JSON — TOON requires round-trip conversion (JSON ↔ TOON). If your downstream system is not LLM-based or does not benefit from token savings, added encoding/decoding overhead may outweigh gains.
License & commercial use
MIT License. Permissive; allows commercial use, modification, and distribution with attribution. No restrictions on proprietary or closed-source applications. Review the LICENSE file in the repo to confirm no additional terms.
MIT license explicitly permits commercial use without licensing fees or restrictions. No vendor lock-in or commercial support obligations; community-driven. For production SLAs or vendor support, consider contacting maintainers or forking for internal maintenance.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Good |
| Assessment confidence | High |
TOON is a data format with no cryptographic, authentication, or network security built in. Use TLS/HTTPS to transmit TOON-encoded data. No buffer overflow or parsing vulnerabilities disclosed. Encoding/decoding is deterministic and lossless. Potential consideration: ensure SDK dependencies (TypeScript) are scanned for CVEs in CI/CD. No formal security audit mentioned in documentation.
Alternatives to consider
JSON (compact variant)
Ubiquitous, native LLM training, no encoding overhead. Suitable if token savings <30% on your data or if integration simplicity outweighs cost. Baseline for benchmarking.
YAML
Human-readable, indentation-based, ~20% fewer tokens than JSON. Lacks CSV-style tabular compaction and explicit field headers for LLMs, but simpler syntax and wider tool support.
CSV + metadata sidecar
Flat tabular data only. For pure tables (no nesting), CSV is most compact. Add a JSON schema or YAML metadata file to describe structure; requires custom parsing logic and loses TOON's schema-in-data approach.
Build on toon with DEV.co software developers
Start with a pilot: integrate TOON encoding into your LLM request pipeline and benchmark token savings on your exact data. Use the TypeScript SDK (npm) or multi-language ecosystem to experiment with no vendor lock-in.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
toon FAQ
How much can I save on tokens with TOON?
Do I need to train my LLM on TOON?
Is TOON stable? Can I use it in production?
Which languages are supported?
Work with a software development agency
Need help beyond evaluating toon? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and ai frameworks integrations — and maintain them long-term.
Ready to reduce LLM token costs?
Start with a pilot: integrate TOON encoding into your LLM request pipeline and benchmark token savings on your exact data. Use the TypeScript SDK (npm) or multi-language ecosystem to experiment with no vendor lock-in.