{ } JSON Workbench100% Private • Zero Server Uploads

"JSON to TOON":{ }

Convert JSON to TOON, the compact Token-Oriented Object Notation for LLM prompts, and back again. See exactly how much smaller it is than both pretty-printed and minified JSON, and count real GPT-4o tokens. Uses the official TOON encoder, running 100% in your browser: nothing is uploaded.

What is a JSON to TOON converter?

LLM APIs bill and limit by tokens, and JSON spends a lot of them on punctuation and repeated keys: an array of 100 user objects repeats "id", "name", and every other key 100 times. TOON states the keys once and lists the values as rows, which is why it shines on tabular data like query results, logs, and product lists. This converter shows the TOON output, the size difference, and exact GPT-4o token counts, so you can decide per payload whether TOON is worth it.

When TOON helps, and when it doesn't

  • Best: arrays of objects that share the same flat fields (the table format kicks in).
  • Neutral: small objects and short configs; compared with minified JSON the difference is a few percent.
  • Worse: deeply nested, irregular data, where indentation can cost more than braces. Measure before switching.

Read the full comparison in TOON vs JSON.

How to use

  1. Paste JSON (or load the sample). The TOON version appears instantly.
  2. Compare sizes: TOON against both pretty-printed and minified JSON, so you see the real saving.
  3. Click Count GPT-4o tokens for exact token counts with the o200k tokenizer (loaded on demand, runs locally).
  4. Pick a delimiter: comma (default), tab, or pipe. Tabs often tokenize best for tables of short values.
  5. Switch to TOON → JSON to decode TOON back into JSON. The round trip is lossless.

Examples

Uniform array → TOON table

Input
{
  "users": [
    { "id": 1, "name": "Ada", "role": "admin" },
    { "id": 2, "name": "Bob", "role": "viewer" }
  ]
}
Output
users[2]{id,name,role}:
  1,Ada,admin
  2,Bob,viewer

Nested object and primitive array

Input
{ "name": "Ada", "tags": ["a", "b"], "meta": { "page": 1 } }
Output
name: Ada
tags[2]: a,b
meta:
  page: 1

FAQ

What is TOON?

TOON (Token-Oriented Object Notation) is a compact text encoding of the JSON data model designed for LLM prompts. It writes uniform arrays of objects as a table, declaring the field names once in a header like users[2]{id,name,role}: and then one row per item, and uses indentation instead of braces for nested objects.

How many tokens does TOON save?

It depends on your data and on what you compare against. For arrays of flat, uniform objects TOON is often 30 to 60 percent smaller than pretty-printed JSON, but against minified JSON the saving is usually much smaller, and for deeply nested or irregular data it can be larger. This tool shows both comparisons and can count real GPT-4o tokens so you can measure instead of guessing.

Is TOON lossless?

Yes. TOON encodes the same data model as JSON (objects, arrays, strings, numbers, booleans, null), so converting JSON to TOON and back returns identical data. Try it with the TOON → JSON tab.

Should I use TOON for LLM output?

TOON is aimed at input: feeding large, structured context to a model cheaply. For model output, JSON with a schema (structured outputs) is still the safer choice because every provider and parser supports it. A common pattern is JSON in your code, TOON in the prompt, JSON back from the model.

Which TOON version does this use?

It uses the official reference encoder, @toon-format/toon 4.4.0, from the authors of the TOON specification, running entirely in your browser.

Is my data uploaded?

No. Encoding, decoding, and token counting all run locally in your browser. Nothing is uploaded while you convert.

Related tools