Turn JSON into TOON to send fewer tokens to ChatGPT, Claude or Gemini, or decode TOON back to JSON.
Everything runs in your browser. Your data is not uploaded.
| Format | Text | Characters |
|---|---|---|
| JSON (minified) | {"orders":[{"id":1001,"customer":"Prajwal Karkera","city":"Austin",...}]} | 245 |
| JSON (pretty) | Same, with spaces and new lines | 403 |
| TOON | orders[3]{id,customer,city,total,paid}: then 3 rows | 146 |
Three orders with five fields each. TOON is about 40% shorter than minified JSON and 64% shorter than pretty JSON.
| Data shape | TOON savings |
|---|---|
| Array of objects with the same keys (tables, logs, orders) | High |
| Flat objects | Medium |
| Deeply nested config | Low; can match JSON |
| Arrays of mixed or very different objects | Low |
| Plain text or a single value | None |
| JSON | TOON |
|---|---|
{"name": "Ada", "age": 36} | name: Ada |
{"tags": ["a", "b"]} | tags[2]: a,b |
{"users": [{"id": 1, "name": "A"}, {"id": 2, "name": "B"}]} | users[2]{id,name}: |
{"user": {"id": 1}} | user: |
| Step | Code |
|---|---|
| Install (npm) | npm i @toon-format/toon |
| JSON to TOON | import { encode } from "@toon-format/toon"; encode(data) |
| TOON to JSON | decode(toonText) |
| Tab delimiter | encode(data, { delimiter: "\t" }) |
| Format | Nested data | Tables | Tokens for LLMs |
|---|---|---|---|
| JSON | Yes | Repeats keys | Most |
| YAML | Yes | Repeats keys | Fewer |
| CSV | No | Yes | Fewest for flat tables |
| TOON | Yes | Keys once | Close to CSV for tables |
| Rule | Example |
|---|---|
| Key and value with a colon | name: Ada |
| Nesting by indentation | user: |
| Array length in brackets | tags[3]: a,b,c |
| Uniform objects as a table | items[2]{sku,qty}: |
| Mixed arrays as a list | - a: 1 rows with a dash |
| Quotes only when needed | "a, b" keeps the comma as text |
| Error | Cause | Fix |
|---|---|---|
| Expected N values, got M | Row count or [N] does not match | Fix the count, or turn off Strict |
| Bad indentation | Mixed 2 and 4 spaces | Pick the same indent in the tool |
| Wrong number of fields | Comma inside a value | Quote the value or use Tab delimiter |
| Delimiter | Best for |
|---|---|
| Comma | Default, easy to read |
| Tab | Text with commas; often fewer tokens |
| Pipe | Human review, logs |
Token-Oriented Object Notation: a compact, lossless way to write JSON data for LLM prompts. Lists of objects become a header plus rows, which uses fewer tokens.
It depends on the data. Uniform arrays of objects often shrink by 30-60% compared with JSON. Deeply nested data may save little.
Yes. Switch to TOON → JSON. The conversion is lossless for valid TOON.
No. The converter runs in your browser using the open-source TOON library.
Comma is the default. Tab often uses fewer tokens and avoids quoting text that contains commas. Pipe is easy to read.
They can read it, especially when you say the data is in TOON format. Test with your own prompts.
Both hold the same data. TOON writes list keys once and uses indentation instead of braces and quotes, so it uses fewer tokens.
CSV is smaller for flat tables but cannot hold nested data. TOON stays close to CSV size for tables and also handles nesting.
Install @toon-format/toon from npm and call encode(data). Use decode(text) to turn TOON back into JSON.
Yes. Valid TOON decodes back to the same JSON data.
Convert your JSON here, paste the TOON in a code block and tell the model the data is in TOON format.
A row count or an [N] length does not match the data. Fix the count or turn off Strict mode.
No. TOON uses a CSV-like header for uniform lists but also supports nested objects and mixed arrays.
The official package is for JavaScript. Community ports exist for other languages; check the official TOON repository.