JSON to TOON Converter

Turn JSON into TOON to send fewer tokens to ChatGPT, Claude or Gemini, or decode TOON back to JSON.

JSON to TOON Converter
Runs in your browser
Paste JSON and press Convert. Runs in your browser; nothing is uploaded.

How to Convert JSON to TOON

1
Paste JSON or upload a .json file
2
Press Convert; pick comma, tab or pipe
3
Copy or download the TOON for your prompt

Everything runs in your browser. Your data is not uploaded.

What Is TOON?

JSON vs TOON: Same Data

FormatTextCharacters
JSON (minified){"orders":[{"id":1001,"customer":"Prajwal Karkera","city":"Austin",...}]}245
JSON (pretty)Same, with spaces and new lines403
TOONorders[3]{id,customer,city,total,paid}: then 3 rows146

Three orders with five fields each. TOON is about 40% shorter than minified JSON and 64% shorter than pretty JSON.

When TOON Saves the Most (and When It Does Not)

Data shapeTOON savings
Array of objects with the same keys (tables, logs, orders)High
Flat objectsMedium
Deeply nested configLow; can match JSON
Arrays of mixed or very different objectsLow
Plain text or a single valueNone

TOON Syntax Cheat Sheet

JSONTOON
{"name": "Ada", "age": 36}name: Ada
age: 36
{"tags": ["a", "b"]}tags[2]: a,b
{"users": [{"id": 1, "name": "A"}, {"id": 2, "name": "B"}]}users[2]{id,name}:
  1,A
  2,B
{"user": {"id": 1}}user:
  id: 1

Using TOON in LLM Prompts

Use TOON in Your Code

StepCode
Install (npm)npm i @toon-format/toon
JSON to TOONimport { encode } from "@toon-format/toon"; encode(data)
TOON to JSONdecode(toonText)
Tab delimiterencode(data, { delimiter: "\t" })

TOON vs JSON vs CSV vs YAML

FormatNested dataTablesTokens for LLMs
JSONYesRepeats keysMost
YAMLYesRepeats keysFewer
CSVNoYesFewest for flat tables
TOONYesKeys onceClose to CSV for tables

Good Uses for TOON

TOON Rules in Detail

RuleExample
Key and value with a colonname: Ada
Nesting by indentationuser:
  id: 1
Array length in bracketstags[3]: a,b,c
Uniform objects as a tableitems[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

Prompt Template Using TOON

Common TOON Decode Errors

ErrorCauseFix
Expected N values, got MRow count or [N] does not matchFix the count, or turn off Strict
Bad indentationMixed 2 and 4 spacesPick the same indent in the tool
Wrong number of fieldsComma inside a valueQuote the value or use Tab delimiter

Which Delimiter Saves the Most?

DelimiterBest for
CommaDefault, easy to read
TabText with commas; often fewer tokens
PipeHuman review, logs

TOON in Other Languages

Related Tools

Frequently Asked Questions

What is TOON format? +

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.

How much does TOON save? +

It depends on the data. Uniform arrays of objects often shrink by 30-60% compared with JSON. Deeply nested data may save little.

Can I convert TOON back to JSON? +

Yes. Switch to TOON → JSON. The conversion is lossless for valid TOON.

Is my data uploaded? +

No. The converter runs in your browser using the open-source TOON library.

Which delimiter should I use? +

Comma is the default. Tab often uses fewer tokens and avoids quoting text that contains commas. Pipe is easy to read.

Do ChatGPT, Claude and Gemini understand TOON? +

They can read it, especially when you say the data is in TOON format. Test with your own prompts.

What is the difference between TOON and JSON? +

Both hold the same data. TOON writes list keys once and uses indentation instead of braces and quotes, so it uses fewer tokens.

Is TOON better than CSV? +

CSV is smaller for flat tables but cannot hold nested data. TOON stays close to CSV size for tables and also handles nesting.

How do I convert JSON to TOON in JavaScript? +

Install @toon-format/toon from npm and call encode(data). Use decode(text) to turn TOON back into JSON.

Is TOON lossless? +

Yes. Valid TOON decodes back to the same JSON data.

How do I write TOON for an LLM prompt? +

Convert your JSON here, paste the TOON in a code block and tell the model the data is in TOON format.

Why does TOON to JSON fail with "Expected values"? +

A row count or an [N] length does not match the data. Fix the count or turn off Strict mode.

Is TOON the same as CSV? +

No. TOON uses a CSV-like header for uniform lists but also supports nested objects and mixed arrays.

Is there a TOON library for Python? +

The official package is for JavaScript. Community ports exist for other languages; check the official TOON repository.

About the creator Prajwal Karkera, creator of ToolsFlow

Built and maintained by Prajwal Karkera, a digital product specialist with 8+ years of experience in digital products. Found a problem with this tool? Let us know through the Contact page.
Read more about me →