JSON Toolbox LogoJSONToolbox

JSON to TOON Converter

Convert JSON to TOON and TOON back to JSON in your browser. Compare minified JSON and TOON by characters, UTF-8 bytes, and estimated tokens for your own data instead of relying on a fixed savings claim.

Paste TOON here...
All processing happens in your browser. No JSON is sent to our servers.

Key Features

Bidirectional JSON and TOON

Convert JSON to TOON for token-sensitive LLM workflows, or convert supported TOON back to JSON for applications, APIs, and standard JSON tools.

Compare Measured Size

See characters, UTF-8 bytes, and estimated tokens for minified JSON and TOON side by side, so the decision is based on your data rather than a fixed savings claim.

Tabular Form for Uniform Arrays

Uniform arrays of objects are emitted with the field names declared once in the header and one row per record, which is where TOON removes repeated syntax.

Show When TOON Is Not Smaller

The page reports when TOON is larger than minified JSON, and flags deeply nested or non-uniform data that may not benefit from conversion.

Validate Both Directions

JSON input is parsed with JSON.parse and TOON input is parsed with a TOON reader that checks declared array lengths and row widths, so malformed input is reported instead of silently accepted.

Round-Trip With Swap

Use Swap Direction to feed the current output back as the input and run the reverse conversion, so you can check whether the data survives a round trip.

Download the Result

Download the converted TOON as a .txt file or the converted JSON as a .json file for prompts, test fixtures, pipelines, or applications.

Browser-Based Processing

Conversion, validation, and comparison happen in your browser. No account is required and the source data is not sent to a remote service.

How to Use

1

Enter JSON or TOON

Paste JSON for JSON-to-TOON conversion, or paste TOON for the reverse direction. Use data that represents the payload you actually plan to send.

2

Choose the direction

Select JSON to TOON or TOON to JSON. Use Swap Direction to feed the output back in and run the reverse conversion.

3

Compare against minified JSON

The comparison always measures TOON against minified JSON, not against indented JSON, because indentation would exaggerate the difference.

4

Review the notices

Read the token-estimate notice, the warning when TOON is larger, and the structure hint that tells you whether a uniform object array was found.

5

Copy or download

Copy or download the representation you choose, then test it with the target model and prompt instructions before relying on it in production.

Convert a Uniform Record Array to TOON

An array of records with the same fields is the structure TOON can represent most compactly.

Input JSON
{
  "users": [
    { "id": 1, "name": "Alice", "role": "admin" },
    { "id": 2, "name": "Bob", "role": "editor" }
  ]
}

An array where every element is an object with the same three primitive fields.

TOON Output
users[2]{id,name,role}:
  1,Alice,admin
  2,Bob,editor

The field names appear once in the header, followed by one row per record with the default comma delimiter.

The comparison panel shows the measured character, byte, and estimated token figures for this input. A deeply nested configuration object usually produces a much smaller difference.

JSON to TOON: Compare Size Before You Switch

What Is TOON?

TOON, or Token-Oriented Object Notation, is a compact representation of JSON-compatible structured data aimed at token-sensitive workflows such as LLM prompts, AI agents, and model tool calls. It uses a tabular representation for repeated object arrays while keeping a readable form for nested data.

TOON is not a universal replacement for JSON. JSON remains the standard format for APIs, browsers, databases, and general application interoperability. TOON is an optional representation to test when reducing LLM input size matters.

How to Compare JSON and TOON

  1. Enter JSON or TOON, depending on the direction you need.
  2. Convert and read the generated output.
  3. Compare TOON against minified JSON by characters, UTF-8 bytes, and estimated tokens.
  4. Read the notices: whether TOON is actually smaller, and whether a uniform object array was found.
  5. Round-trip with Swap Direction to confirm the data survives.
  6. Test comprehension: confirm that the target model and prompt instructions interpret the TOON output correctly.

Why Uniform Arrays Can Benefit

A repeated array of objects spells out the same field names many times in JSON:

{"users":[{"id":1,"name":"Alice","role":"admin"},{"id":2,"name":"Bob","role":"editor"}]}

The tabular form declares the fields once and writes the values as rows:

users[2]{id,name,role}:
  1,Alice,admin
  2,Bob,editor

This is the main structural situation in which TOON removes repeated syntax.

TOON Is Not Always Smaller

Size depends on the shape of the data. Uniform arrays may benefit, while deeply nested objects, sparse records, mixed arrays, or configuration objects can produce little difference or increase the output. That is why this page reports the measured result and warns when TOON is larger, instead of repeating a fixed savings range.

Characters, Bytes, and Tokens Are Different

Characters are what the editor shows, UTF-8 bytes are what is transmitted or stored, and tokens are what a model bills. A representation can be smaller in characters but not in tokens, because tokenizers split text in their own way. Compare the metric that matches your cost.

About the Token Estimate

This page estimates tokens by dividing the character count by four and rounding up, using the same formula for both sides. That is a rough comparative heuristic, not a count from a specific model tokenizer. Real counts differ between models and tokenizers, so verify with your own tokenizer before making cost decisions.

What This Page Supports

The converter handles objects and nested objects, primitive arrays in inline form, uniform arrays of objects in tabular form, non-uniform and mixed arrays in list form, empty arrays and empty objects, root primitives, root objects and root arrays, and comma, tab, or pipe delimiters. It does not implement the keyed tabular root form, nested field groups, key folding, or path expansion.

Round-Trip and Validation

The TOON reader checks that declared array lengths match the number of rows or items, so a document with a wrong count is reported rather than silently decoded. Use Swap Direction to feed the output back and check that your data survives a round trip, paying attention to strings that contain delimiters, colons, quotes, or leading and trailing spaces.

Privacy and Browser-Based Processing

Conversion and comparison happen in the browser, so pasted payloads stay on your device. That suits prompts and development data, but it is not a secret-management system. Avoid entering credentials, private prompts, or confidential production payloads into any online tool.

When to Use Local Code

For repeated pipelines, very large payloads, or confidential data, run the conversion in your own environment where you control logging, token counting, and data retention. The browser tool is best for inspection, one-off comparison, and deciding whether TOON is worth adopting for a given payload shape.

Related Tools

Frequently Asked Questions

What is TOON?

TOON stands for Token-Oriented Object Notation. It is a compact representation of JSON-compatible structured data aimed at token-sensitive LLM workflows. It uses a tabular form for repeated object arrays while keeping a readable form for nested data.

Does TOON always use fewer tokens than JSON?

No. The result depends on the data structure and the tokenizer. Uniform arrays of objects may become smaller, while deeply nested, sparse, mixed, or configuration-like data can produce little difference or become larger than minified JSON. The comparison panel reports what happens for the data you paste.

Why is TOON compared with minified JSON?

Because that is the realistic baseline. Comparing TOON against indented JSON measures formatting overhead rather than serialization efficiency, which makes the difference look bigger than it is.

How accurate is the token estimate?

It is a rough estimate, not a count from a model tokenizer. This page divides the character count by four and rounds up, applying the same formula to both sides. Real token counts differ between models and tokenizers, so treat the numbers as comparative guidance and verify with your own tokenizer for cost decisions.

Which TOON syntax does this page support?

Objects and nested objects with key: value lines and two-space indentation; primitive arrays in inline form such as tags[3]: admin,ops,dev; uniform arrays of objects in tabular form with a header declaring the fields; non-uniform arrays and mixed values in list form with dash items; empty arrays as key: [] and empty objects as key:; root primitives, root objects and root arrays; and comma, tab, or pipe delimiters declared in the header.

Which TOON features are not supported?

The keyed tabular root form such as [2:]{age,city}:, nested field groups such as field{sub1,sub2}, key folding, and path expansion are not implemented. Input using them is reported as invalid rather than being partially decoded.

Can I convert TOON back to JSON?

Yes, for the syntax listed above. The parser also checks that declared array lengths match the number of rows or items, so a document with a wrong count is reported instead of being silently accepted.

Does the conversion preserve my data?

For the supported syntax, yes: strings, numbers, booleans, null, objects, arrays, and key order are preserved, and the page can decode what it encodes. Use Swap Direction to run a round trip on your own data and compare the result, especially for strings that contain delimiters or colons.

Which delimiters are supported?

Comma, tab, and pipe. The chosen delimiter is declared inside the TOON header and is used for inline arrays, tabular rows, and the header field list. Values containing the active delimiter are quoted automatically.

When is TOON most useful?

Mostly for large arrays of uniform objects and other tabular data sent to an LLM, where repeated field names are the bulk of the syntax. Test the actual payload before adopting it for prompts, agents, or pipelines.

When should I keep minified JSON?

Keep minified JSON when compatibility, standard tooling, deep nesting, sparse objects, configuration data, or broad parser support matters more than a possible size reduction.

Is TOON a replacement for JSON APIs?

No. JSON remains the broadly supported interchange format for APIs, browsers, databases, and application libraries. TOON is better treated as an optional representation for compatible AI or token-sensitive workflows.

Can I use TOON with every LLM?

Not automatically. The target model has to understand the TOON syntax, and your prompt or system instructions may need to explain the format. Test comprehension and output reliability before using it in production.

Does TOON reduce API costs?

It may reduce input-token cost when it produces fewer tokens for your tokenizer, but actual cost depends on the model, tokenizer, payload, prompt instructions, output behaviour, and pricing. Measure your real workflow instead of assuming a fixed percentage.

Can I compare TOON with CSV here?

No. This page compares TOON with minified JSON only. There is no CSV comparison on this page.

Can I convert a large JSON file?

The practical limit depends on document size, nesting depth, browser memory, and rendering. Very large payloads may be slow to render in the editor, in which case a local conversion step is a better fit.

Is my JSON or TOON uploaded to a server?

No. The page parses, converts, and compares data in your browser. You should still avoid entering private prompts, API keys, customer data, or confidential production payloads into any browser-based tool.

Is this a free JSON to TOON converter?

Yes. You can convert supported JSON and TOON data, compare the representations, and copy or download the output without creating an account.