Skip to main content

JSON to TOON

New

Convert JSON to TOON, a compact token-oriented format that reduces token usage in LLM prompts.

jsontoonllmtokensconvert
Read the guide
Shortcuts:⌘ KSearch

Implements the common subset of the TOON spec: objects, inline primitive arrays, tabular arrays and list arrays. Token figures are estimates (about 4 characters per token).

Continue with:

Frequently Asked Questions

What is TOON and why would I use it instead of JSON?

TOON (Token-Oriented Object Notation) is a line-oriented format that declares an array's length and field list once instead of repeating property names on every object, which typically uses fewer tokens than equivalent JSON when the data is sent to an LLM prompt.

How does the tool decide between the tabular and inline array forms?

If every item in an array is an object and they all share the exact same set of keys, it uses TOON's tabular form (key[N]{a,b,c}: followed by comma-separated rows). If it's an array of plain values, it uses a compact inline list. Anything less uniform falls back to a hyphenated list form.

How is the token savings estimate calculated?

It's a rough approximation — total character count divided by 4, which is a commonly used rule of thumb for English text and JSON-like structures. It won't match an exact tokenizer count, but it's a useful directional signal for how much more compact the TOON output is.

Are strings always quoted the same way as JSON?

No — TOON only quotes a string when it's ambiguous without quotes: if it's empty, has leading/trailing whitespace, contains a delimiter/colon/brace, or looks like a number, boolean, or null. Otherwise it's written bare to save characters.

Can I convert TOON back to JSON with this tool?

Yes. Switch to TOON → JSON (or open the TOON to JSON tool). Declared array lengths and table row widths are validated and errors name the offending line.

Which delimiters are supported?

Comma, tab and pipe. Tab and pipe can save more tokens when values contain commas.

Related Tools