{ } JSON Workbench100% Private • Zero Server Uploads

TOON vs JSON

TOON (Token-Oriented Object Notation) is a compact text format for the same data JSON represents, designed to make structured data cheaper to put in an LLM prompt. It writes arrays of similar objects as a table with the field names stated once, and uses indentation instead of braces. The short answer to "is it better?": TOON clearly beats JSON on large uniform lists, but against minified JSON it can be bigger for nested or irregular data. The numbers below show both cases.

The same data in JSON and TOON

Three orders as JSON:

{
  "orders": [
    { "id": 1001, "customer": "Ada", "status": "shipped", "total": 59.9 },
    { "id": 1002, "customer": "Linus", "status": "pending", "total": 12.5 },
    { "id": 1003, "customer": "Grace", "status": "shipped", "total": 140 }
  ]
}

And as TOON:

orders[3]{id,customer,status,total}:
  1001,Ada,shipped,59.9
  1002,Linus,pending,12.5
  1003,Grace,shipped,140

The header orders[3]{id,customer,status,total}: says there are 3 items and names the fields once; each following line is one item. JSON repeats "id", "customer", "status", and "total" for every order, plus the braces and quotes around them. Convert your own data with the JSON to TOON converter.

Real token counts

We encoded three typical payloads with the official TOON encoder and counted tokens with the GPT-4o tokenizer (o200k):

DataPretty JSONMinified JSONTOONTOON vs minified
50 uniform orders (5 fields each)2,1571,20380533% smaller
Nested service config1839311928% larger
20 users with varying fields71036247030% larger

Two things stand out. First, every TOON result is far smaller than pretty-printed JSON, which is where most "TOON halves your tokens" claims come from. Second, if you already send minified JSON, TOON only wins when the data is a uniform table; for nested or irregular objects, indentation costs more tokens than JSON's punctuation. With a tab delimiter, the orders example improved slightly further, to 36% smaller than minified JSON.

Side-by-side comparison

AspectJSONTOON
PurposeUniversal data interchangeCompact LLM prompt input
Arrays of objectsKeys repeated on every itemTable: keys once, one row per item
NestingBraces and bracketsIndentation
StringsAlways quotedQuoted only when needed
Array lengthsImplicitExplicit ([3]), helps models and validation
ToolingBuilt into every languageLibraries for a growing set of languages
Best forAPIs, storage, model outputLarge uniform lists in prompts

When to use TOON

When to stay with JSON

The practical approach is to measure. Paste a real payload into the converter, compare against minified JSON, and count tokens before changing your prompts.

Related tools

Frequently asked questions

What is TOON format?

TOON (Token-Oriented Object Notation) is a compact, human-readable encoding of the JSON data model built to reduce the number of tokens structured data costs in an LLM prompt. It uses indentation for nesting (like YAML) and a table layout for arrays of uniform objects (like CSV), declaring field names once instead of on every item.

Is TOON better than JSON?

Only for some data. In our measurements with the GPT-4o tokenizer, TOON was 33% smaller than minified JSON for a list of 50 uniform orders, but about 30% larger than minified JSON for nested config and for objects with varying fields. Against pretty-printed JSON, TOON was always smaller.

Does TOON save tokens with every model?

Token counts depend on each model's tokenizer, so savings differ between models, but the pattern holds: TOON saves the most on large uniform arrays, where JSON repeats every key on every item. Measure your own payloads with the JSON to TOON converter, which counts GPT-4o tokens.

Can LLMs read TOON?

Yes. TOON is plain text with explicit array lengths and field headers, and the TOON project reports comparable or slightly better retrieval accuracy than JSON in its benchmarks. As with any format, test it on your own task before switching production prompts.

Should LLMs output TOON?

Usually not. TOON is designed for input. For model output, JSON with a schema (structured outputs, function calling) is better supported by every provider and parser. A common pattern: keep JSON in your code, send TOON in the prompt, ask for JSON back.

Is TOON lossless?

Yes. TOON encodes exactly the JSON data model, so JSON converted to TOON and back is identical.