Convert Multiple Data Formats into TOON — A New Way to Optimize LLM Input
When working with Large Language Models, the structure and size of your data matter far more than we usually admit. JSON is convenient and universal, but it isn’t always the most efficient choice when sending large payloads to an LLM. Recently, a new encoding format has started gaining attention for its compactness and model-friendliness: TOON — Token-Oriented Object Notation.
In this article, I’ll explain what TOON is, why developers should care about it, and how you can easily convert JSON, YAML, CSV, XML, TOML and even TOON itself using a lightweight, fully client-side tool.
What Is TOON?
Token-Oriented Object Notation is a compact, human-readable encoding of the JSON data model. Its goal is simple:
👉 Minimize token count while keeping structure easy for LLMs to follow.
TOON is intended as a drop-in, lossless replacement for JSON when the destination is a language model. Programmatically, you can keep using JSON—TOON acts more like a translation layer to reduce tokens and improve model comprehension.
How It Works
TOON blends ideas from formats developers already know:
- YAML-style indentation for nested objects
- CSV-style tabular rows for uniform arrays
- JSON-like compatibility for encoding the same data model without loss
Its sweet spot is uniform arrays of objects—cases where you have rows with identical structure. Here, TOON often achieves CSV-level compactness while adding explicit structure so LLMs can parse and validate data more reliably.
When Is It Better Than JSON?
TOON excels in:
- structured datasets
- multi-row tabular objects
- large collections where token savings compound
For deeply nested or inconsistent data, JSON can still be more compact, but in many real-world use cases, TOON provides a clear efficiency advantage.
Efficiency: How Much Better Is TOON Really?
Recent benchmarks comparing multiple data formats measured accuracy per 1,000 tokens (higher is better):
TOON ████████████████████ 26.9 acc%/1K tok │ 73.9% acc │ 2,744 tokens
JSON compact █████████████████░░░ 22.9 acc%/1K tok │ 70.7% acc │ 3,081 tokens
YAML ██████████████░░░░░░ 18.6 acc%/1K tok │ 69.0% acc │ 3,719 tokens
JSON ███████████░░░░░░░░░ 15.3 acc%/1K tok │ 69.7% acc │ 4,545 tokens
XML ██████████░░░░░░░░░░ 13.0 acc%/1K tok │ 67.1% acc │ 5,167 tokens
Efficiency score = (Accuracy % ÷ Tokens) × 1,000
Key Takeaways
- TOON achieves 73.9% accuracy vs. JSON’s 69.7%
- It uses 39.6% fewer tokens than JSON
- CSV was excluded because it can’t represent nested structures, but TOON reaches similar compactness while remaining fully expressive
In short:
You get better model performance and lower token usage.
Convert JSON, YAML, CSV, XML, TOML ↔ TOON Easily
If you want to experiment with TOON in real workflows, format conversion is often the first hurdle.
I built a small, fast, privacy-friendly tool that lets you convert:
➡️ JSON → TOON
➡️ YAML → TOON
➡️ XML → TOON
➡️ TOML → TOON
➡️ CSV → TOON
➡️ TOON → JSON / YAML / XML / TOML / CSV
Everything runs 100% client-side, so:
- your data never leaves your browser
- nothing is stored on a server
- conversions are instant and private
It’s a convenient way to compare how each format behaves and see firsthand how many tokens TOON can save in your own datasets.
You can try it here:
👉 https://json2toon.co/
Why Developers Should Care
With LLMs becoming more deeply integrated into apps, token efficiency has become an engineering problem, not an academic curiosity.
TOON helps by:
- reducing token spend
- improving parsing consistency
- keeping data readable
- remaining fully compatible with JSON’s data model
And because it's lossless, you can convert back and forth without worrying about structural drift.
Final Thoughts
TOON gives developers a new lever to optimize LLM interactions without changing their underlying data model. If you're using AI agents, batch processing, or prompting models with structured inputs, TOON is absolutely worth exploring.
Try converting your own data, compare the token counts, and see how much efficiency you can reclaim.
Top comments (0)