JSON to TOON Converter: Cut LLM Token Costs 30–60% (2026 Guide)
If you've shipped anything that pumps JSON into GPT-4o, Claude, or Gemini, you've felt the bill grow faster than the feature list. Every brace, every quoted key, every repeated field name turns into tokens — and tokens turn into euros. TOON (Token-Oriented Object Notation) is a new serialization format built specifically to fix that. It encodes the same data as JSON, losslessly, but in 30–60% fewer tokens for the kind of payloads most LLM applications actually send.
This guide walks through what TOON is, where it wins and where it doesn't, how to convert JSON to TOON in your browser, and what monthly savings to expect on a realistic workload. There's a worked example with real token counts, a cost scenario in euros, and a free JSON to TOON converter at the end that runs entirely on your device — no upload, no account, no tracking. If you're optimizing LLM token costs or hitting context-window limits, this is the most boring, mechanical win available right now.
What is TOON?
TOON stands for Token-Oriented Object Notation. It's a compact, human-readable text format that represents the JSON data model using indentation (for nested objects) and a CSV-like tabular layout (for arrays of similarly-shaped objects). The format went public in late 2025 and reached version 3.0 in November of that year, which added an official media type (text/toon) and a stable spec under the toon-format GitHub organization.
The core idea is simple: JSON repeats field names and structural punctuation on every record, and language model tokenizers count every single one of those characters. TOON declares field names once, drops braces and quotes wherever it can, and lets the LLM read the rest as tabular rows. Crucially, the format is lossless — you can convert JSON → TOON → JSON and end up with the exact same data — so it's a translation layer at the LLM boundary, not a replacement for JSON in your stack.
JSON vs TOON: A Side-by-Side Example
Here's a typical payload — three users in a list, the kind of thing you'd inject into a RAG prompt or a tool-calling context:
{
"users": [
{ "id": 1, "name": "Alice", "role": "admin" },
{ "id": 2, "name": "Bob", "role": "editor" },
{ "id": 3, "name": "Charlie", "role": "viewer" }
]
}
The equivalent in TOON:
users[3]{id,name,role}:
1,Alice,admin
2,Bob,editor
3,Charlie,viewer
Same information, no loss. The field names id, name, and role appear once instead of three times. The braces, the quotes around every string, and the commas between objects are gone. Tokenized with the GPT-4o tokenizer, the JSON above runs around 50 tokens; the TOON version runs around 25. With ten thousand rows instead of three, that ratio holds — which is where the format earns its keep.
Now look at a deeply nested config object, which is where TOON has less to offer:
{
"database": { "host": "localhost", "port": 5432 },
"cache": { "ttl": 3600 }
}
database:
host: localhost
port: 5432
cache:
ttl: 3600
Modest gain. The structure has nowhere repetitive for TOON's tabular layout to shine. This is the honest pattern: TOON is designed for uniform arrays of objects, and that's where the big numbers live.
How Much Does TOON Actually Save?
Published benchmarks and field reports show a consistent pattern:
- Uniform arrays of objects (the sweet spot): 40–60% fewer tokens versus pretty-printed JSON; 30–45% versus minified JSON. RAG knowledge chunks, product catalogs, KPI libraries, and analytics rows all live here.
- Mixed-shape arrays: 10–25% savings, sometimes less, because TOON has to fall back to a non-tabular layout.
- Deeply nested configuration objects: often a wash, sometimes a small increase in tokens versus minified JSON.
- Pure flat tables: CSV is still smaller than TOON; TOON adds explicit structure (array length declarations, field headers, delimiter scoping) at ~5–10% overhead, which improves LLM parse reliability.
The takeaway: TOON is a specialist, not a universal upgrade. If your prompts mostly carry catalogs, lookup tables, RAG chunks, analytics rows, or user/product lists, you're squarely in the savings zone. If they ship small or deeply-nested config blobs, the gain will be marginal — and that's worth knowing before you wire up a conversion step.
When TOON Wins — and When It Doesn't
Reach for TOON when:
- You're passing reference data (catalogs, KPI definitions, entity lists) where the same fields repeat across many rows.
- You're hitting context-window limits and need to fit more data in the same prompt.
- Your call volume is high enough that 30–60% lower input cost shows up as real money on the invoice.
Stick with JSON when:
- Your data is deeply nested with varying shapes per item.
- You're talking to other systems (APIs, databases, schema validators) — they expect JSON, and conversion both ways just adds friction.
- Your prompts are small enough that engineering overhead outweighs the savings.
The cleanest production pattern is to keep JSON everywhere in your code, and encode to TOON only at the boundary — the moment before a prompt leaves for the model. That way your storage, APIs, validators, and team conventions never have to know TOON exists.
How to Convert JSON to TOON in Your Browser
The fastest way to see what TOON will do for a specific payload is to paste it into ToolPry's JSON to TOON Converter. It runs entirely in your browser using the official open-source TOON library, vendored locally — nothing is uploaded, no account is needed, and the tool works offline after the first load.
What the ToolPry converter gives you that most of the thin online converters don't:
- Live token counts for both formats across GPT-4o, GPT-4, Claude, and Gemini, updating as you type.
- A € cost comparison for the selected model, so you see what a real prompt would cost in JSON vs TOON for your data.
- Honest precision: OpenAI counts are exact (their tokenizer is public); Claude and Gemini are clearly labelled as estimates, because their tokenizers aren't openly available for current models. No converter that hides this distinction can give you the truth.
- Bidirectional conversion (JSON ⇄ TOON) so you can round-trip safely and verify nothing changed.
- 100% client-side privacy — important for proprietary, customer, or regulated data, and consistent with GDPR's data-minimisation principle.
Using TOON in Your Code
For production use, the official @toon-format/toon npm package gives you encode and decode in TypeScript or JavaScript:
import { encode, decode } from "@toon-format/toon";
const data = {
users: [
{ id: 1, name: "Alice", role: "admin" },
{ id: 2, name: "Bob", role: "editor" }
]
};
const toon = encode(data); // pass this to the LLM
const back = decode(toon); // round-trip back to JSON
There's a Python implementation (toon-format) on PyPI, plus community ports for other languages. The official specification lives on GitHub at toon-format/spec if you want to read the canonical syntax rules. The library and the spec are both MIT-licensed, which is why ToolPry can vendor them locally without strings attached.
A Real Cost Scenario in Euros
Suppose you run a RAG-style support assistant that handles 1,000 requests per day. Each request injects a ~5,000-token JSON reference block — FAQ entries, product specs, or policy rows. That's 5 million input tokens per day, ~150 million per month.
At a representative input price of around €2.50 per million tokens for a mid-tier model, that's €375 per month just on the input cost of the reference block. If TOON shrinks that block by 50% — which is typical for repeated, uniform records — you're paying €187.50 per month instead. That's roughly €2,200 per year saved, on one prompt template, by changing a single line of code.
These numbers are illustrative — your exact model, pricing, and data shape will move them up or down. Use the converter with one of your actual payloads to see the figure that matters for your stack.
Frequently Asked Questions
Is TOON safe to use with sensitive data?
The format itself is just text — no more or less safe than JSON. The risk depends on the tool you convert with: if you paste customer data into a server-side converter, that data has now left your control. ToolPry's converter runs 100% in your browser, your input is never transmitted, and the tool works offline. That makes it appropriate for proprietary, customer, or regulated payloads in a way that most online converters aren't.
Will an LLM understand TOON without training?
Modern frontier models handle TOON well, especially when you include a short example in the system prompt showing the format. Comprehension benchmarks suggest accuracy is on par with JSON for the data shapes TOON is designed for. For high-stakes production use, run a small benchmark on your specific model before committing.
Does TOON replace JSON?
No, and it's not meant to. JSON remains the right tool for storage, APIs, configuration, schema validation, and inter-service communication. TOON is a transport optimization for exactly one boundary: your code → the LLM.
What does TOON stand for?
Token-Oriented Object Notation. The name signals the design goal: a notation specifically tuned for how language models tokenize text, not for how humans or databases consume it.
Is the ToolPry converter free?
Yes, free and unlimited, no sign-up. ToolPry is funded by consent-gated Google AdSense and community support — never by selling user data.
How is this different from minifying JSON?
Minification strips whitespace; it doesn't remove repeated field names, quotes around keys, or the structural punctuation that LLM tokenizers charge for. Minified JSON is smaller than pretty-printed JSON, but TOON is typically still 20–40% smaller than minified JSON on uniform arrays — because it changes the encoding, not just the formatting.
Try it now
Paste a JSON payload into the JSON to TOON Converter and see the token savings for your data, your model, in real time. If you're already comfortable with JSON tooling, you might also want the JSON Formatter & Validator for cleaning input before conversion, the Base64 Encoder for handling binary payloads inside LLM prompts, and the Regex Tester for pre-processing strings before they hit the model. All of it runs in your browser.