Callculation
JSON to TOON Converter
TOON format, Token-Oriented Object Notation converter

JSON to TOON Converter

Transform JSON into TOON format instantly — compact, token-based, and developer-friendly.

You can paste raw or formatted JSON text. Single quotes will be automatically fixed.

If enabled, duplicate keys in objects will be preserved.

The JSON to TOON Converter instantly transforms standard JSON data into TOON (Token-Oriented Object Notation) — a modern, tokenized data format designed for readability, compactness, and machine efficiency. It also lets you customize how TOON is encoded with indentation, key folding, and delimiter options.

This browser-based tool runs locally and shows a detailed comparison between JSON and TOON, including token count and space savings.

What Is TOON Format?

TOON stands for Token-Oriented Object Notation — a human-readable, JSON-inspired syntax that represents structured data as an ordered list of tokens. It minimizes repetition and enables flexible extensions for typed data, annotations, and metadata.

TOON is open-source and defined at github.com/toon-format/toon.

How JSON to TOON Conversion Works

When you paste JSON, the tool parses it into an abstract syntax tree (AST) and serializes that structure into TOON tokens. Arrays, objects, and primitives are mapped into ordered, self-descriptive tokens using the @toon-format/toon library.

All processing happens locally — no upload required. You can also copy the resulting TOON code or compare its size and token efficiency directly in the result table.

Configurable Output Settings

The converter provides advanced controls for customizing how TOON output is formatted:

  • Indentation: Controls how many spaces per level are used in nested data. Choose between 0 (compact), 2, or 4 spaces for better readability.
  • Key Folding: Collapses objects with single nested keys into a shorter dotted form (e.g. data.metadata.items instead of nested indentation). 'Safe' mode ensures readability without flattening complex structures.
  • Delimiter: Defines how array elements and inline values are separated (comma, semicolon, or pipe). Useful for aligning with other serialization styles.
  • Allow Duplicates: Keeps repeated keys intact in TOON output if your input data includes them intentionally.

These parameters let developers fine-tune TOON output for compactness, compatibility, or readability depending on the use case.

Why Use TOON Instead of JSON?

  • Compactness: Removes redundant syntax and quotes, reducing size up to 70%.
  • Extensibility: Supports annotations and metadata for richer structures.
  • Speed: Easier to parse for both humans and machines.
  • Customization: Adjustable indentation, key folding, and delimiters.
  • Interoperability: Designed to coexist with JSON pipelines.

Example: JSON vs TOON

// JSON
{
  "user": { "name": "Alice", "age": 25 }
}

// TOON (safe folding + comma delimiter)
user{name,age}: Alice,25

Frequently Asked Questions (FAQ)

What does this converter do?

It converts any valid JSON input into TOON (Token-Oriented Object Notation), showing how your structured data would look in a compact, tokenized format.

What do the indentation, key folding, and delimiter settings do?

Indentation changes how nested levels are displayed. Key folding collapses long nested chains into dotted keys for brevity. Delimiter controls how inline arrays or value groups are separated (e.g. commas or pipes). These affect readability but not the underlying structure.

Is TOON a replacement for JSON?

No. TOON is an experimental compact representation meant to complement JSON — useful for visualization, compression, and exploring future serialization techniques.

Does conversion happen locally?

Yes. All processing is done in your browser; your data never leaves your device.

Can I compare size and token usage?

Yes. After conversion, the tool displays a JSON vs TOON comparison table showing approximate token count, byte size, and percentage savings.

Can I convert back from TOON to JSON?

Yes. The TOON library supports reverse parsing to reconstruct valid JSON structures from TOON text.

Why should I care about TOON?

TOON provides a new way to visualize and optimize structured data. It’s useful for developers, educators, and data engineers interested in compact data representation.

References