JSON

JSON to TOON

Paste JSON to get TOON, a compact format for LLM prompts that names the fields of a list once instead of in every object. The four-person team list below shrinks from 243 characters of minified JSON to 131 in TOON, 46% fewer; deeply nested data saves little or nothing.

Runs in your browser. Nothing you enter is sent to a server.

Delimiter
Indent
Converts as you type.
TOON
team: Platform
members[4]{id,name,role,active}:
  1,Ana,admin,true
  2,Budi,editor,true
  3,Citra,viewer,false
  4,Dewi,editor,true
Tokens: TOON vs minified JSON −44% estimate

About 40 tokens in TOON and 71 in minified JSON. Characters: 131 and 243 (−46%).

The same data in each format
FormatCharactersBytesTokens (est.)
JSON as entered423423140
JSON, minified24324371
TOON13113140

Token counts are estimates. The text is split the way GPT-4's tokenizer splits it before it applies its vocabulary; real counts are the same or higher and differ between models. How the estimate works.

Advertisements

What is TOON?

TOON (Token-Oriented Object Notation) carries the same data as JSON (objects, arrays, strings, numbers, booleans and null) in a form that takes fewer tokens when you put it in a prompt for a large language model.

  • Objects use indentation instead of braces, and plain keys need no quotes.
  • A list of objects with the same fields becomes a table: members[4]{id,name,role,active}: names the fields once, then each object is one row.
  • Every array states its length, such as [4], so a reader can tell when rows are missing.
  • Strings are quoted only when they would otherwise read as something else, such as "true", "42" or text that contains the delimiter.

When TOON helps, and when it does not

TOON saves space by writing repeated keys once. When keys do not repeat, every nesting level still costs a line break and indentation, and tokenizers count those too. These figures come from this converter:

DataMinified JSONTOONTokens (est.)
Team list from the example: 4 objects, same 4 fields243 chars, ≈71 tokens131 chars, ≈40 tokens−44%
Server config, nested 3 levels deep190 chars, ≈47 tokens181 chars, ≈57 tokens+21%
List of 3 objects with different fields170 chars, ≈56 tokens187 chars, ≈77 tokens+38%
One value nested 6 levels deep37 chars, ≈15 tokens49 chars, ≈19 tokens+27%

So convert tables of records (search results, rows from a database, product lists, logs) and keep nested or irregular data as minified JSON. The converter flags data where TOON comes out larger.

How the token estimate works

A real tokenizer needs its whole vocabulary, about 100,000 entries for GPT-4's, which is more than a converter page should download. Instead, this page splits the text with the same pattern that GPT-4's tokenizer (cl100k_base) applies before it looks pieces up in its vocabulary: words with their leading space, numbers in groups of up to three digits, runs of punctuation and runs of whitespace.

  • Each piece becomes at least one token, so for that tokenizer the real count is the same or higher.
  • Rare words and punctuation runs such as ":[{" often take more than one token.
  • Other models use other tokenizers. Use the numbers to compare formats, not to predict an exact count.

Which version of TOON?

The converter follows TOON specification version 4.4 (8 October 2026) and passes all 564 conformance tests published with it.

  • Encoder options are the two the specification defines: the delimiter (comma, tab or pipe) and the indent size. Version 4.4 has no length-marker option; the older [#3] form is rejected.
  • When reading TOON, the indent size is detected from the text. Strict checks are on by default; turning them off applies the specification's non-strict recoveries, such as accepting a wrong array length.
  • Comment lines starting with # are accepted in TOON input and dropped, as the specification requires.
  • Numbers are JavaScript numbers. Whole numbers above 9,007,199,254,740,991 are rounded, and the converter tells you when that happens.
  • JavaScript lists keys that look like whole numbers, such as "42", before other keys, so their position can change.

Questions

What is TOON?

TOON (Token-Oriented Object Notation) is a text format for the same data as JSON, designed to take fewer tokens in LLM prompts. Objects use indentation instead of braces, and a list of objects with the same fields becomes a table: the field names appear once in a header such as users[2]{id,name}:, followed by one comma-separated row per object.

Does TOON always use fewer tokens than JSON?

No. It saves the most on lists of objects that share the same fields. For deeply nested or irregular data, the line breaks and indentation can cost as much as JSON's braces and quotes, or more. The converter shows the size of both formats, so you can check your own data.

Can I convert TOON back to JSON without losing anything?

Yes. Choose TOON → JSON. Converting JSON to TOON and back returns the same data. Two limits come from JavaScript rather than TOON: whole numbers above 9,007,199,254,740,991 lose precision (the converter warns you), and keys that look like whole numbers, such as "42", are listed first.

Which delimiter should I choose?

Comma is the default. Only values that contain the chosen delimiter need quotes, so if many values contain commas, such as addresses or sentences, tab or pipe avoids that quoting. Switch the delimiter and compare the sizes for your data.

How are the token counts estimated?

The text is split the way GPT-4's tokenizer (cl100k_base) splits it before it applies its vocabulary, and the pieces are counted. Each piece is at least one token, so for that tokenizer the real count is the same or higher. Other models use other tokenizers, so use the numbers to compare formats, not as an exact count.

Support this site

The tools are free and need no account. If one saved you time, a small donation helps keep them running.

Want a tool or feature? Suggest it for free, or donate and write your request in the message. Supporters' requests are looked at first.