JSON to TOON

Free Token-Oriented Object Notation · Up to 60% fewer tokens for LLM prompts
Delimiter
Indent
Error
JSON
TOON
// output here

Más Herramientas para Desarrolladores

Formateador JSON
Formatear & validar
JSON→YAML
A YAML
JSON→CSV
A CSV
JSON→XML
A XML
Formateador TOON
Formatear & validar
TOON→JSON
A JSON
Base64
Codificar/Decodificar
URL Encoder
Codificar URL

About TOON (Token-Oriented Object Notation)

What is TOON?

TOON is a compact, lossless encoding of the JSON data model designed for LLM prompts. It uses YAML-style indentation for nested objects and a CSV-style tabular layout for uniform arrays — up to 60% fewer tokens than JSON.

Tabular Arrays

TOON's biggest win: arrays of uniform objects collapse into a header row [N,]{fields}: followed by comma-separated data rows — just like CSV but with explicit structure.

Minimal Quoting

Strings are only quoted when necessary — when they look like a number, boolean, null, contain the delimiter, have leading/trailing whitespace, or are empty. Everything else is written bare.

LLM-Optimised

TOON achieves 76% LLM accuracy vs JSON's 75% on data-retrieval benchmarks, while using ~40% fewer tokens. Best used as a translation layer: keep JSON for APIs, send TOON to LLMs.

Preguntas Frecuentes

How does TOON encode nested objects?

Nested objects use indentation instead of curly braces. Each key-value pair is written as key: value, and nested objects add one level of indentation (2 spaces by default).

What is the tabular array format?

When all objects in an array share the same primitive-valued fields, TOON writes a header [N,]{f1,f2,f3}: followed by one comma-separated row per object. This is the biggest source of token savings.

Is TOON lossless?

Yes. TOON encodes the same objects, arrays, and primitives as JSON. You can round-trip JSON → TOON → JSON without any data loss. Types are preserved through TOON's quoting rules.

When should I use TOON vs JSON?

Use TOON when sending structured data to an LLM as context or input. The token savings directly reduce API cost and allow more data to fit in the context window. Keep JSON for programmatic APIs, databases, and anywhere that requires strict interoperability.

Guía detallada
Guía JSON Completa
Formatear, validar, convertir
Leer la guía