JSON to TOON Converter

What is a Toon Converter?

When you send structured data to a large language model, every brace, quote and repeated key costs tokens. TOON (Token-Oriented Object Notation) is a compact text format designed for LLM prompts. It writes uniform arrays of objects as a table with the keys declared once, which can significantly reduce token counts compared with JSON.

How to use it

  1. Paste JSON or YAML.
  2. Copy the TOON output and include it in your prompt.
  3. Compare the approximate token counts if shown.

Example

JSON (written with single quotes here):

{ 'users': [
  { 'id': 1, 'name': 'Asha', 'role': 'admin' },
  { 'id': 2, 'name': 'Ben', 'role': 'user' },
  { 'id': 3, 'name': 'Chen', 'role': 'user' } ] }

TOON:

users[3]{id,name,role}:
  1,Asha,admin
  2,Ben,user
  3,Chen,user

The header declares the array length and field names once, and each row lists only values, similar to CSV with structure.

When TOON helps most

  • Large arrays of objects with the same fields, such as product lists, logs, search results and database rows.
  • Agent tools that return tabular data to a model.
  • Prompts that are close to the context window or cost limits.

When to stay with JSON

  • Deeply nested or irregular data, where TOON saves little.
  • When the model must produce output that other software parses; JSON with a schema is more reliable.
  • Always test that your model reads the format accurately for your use case.

Frequently Asked Questions

What is TOON?

Token-Oriented Object Notation, a compact format for passing structured data to language models with fewer tokens than JSON.

How much does TOON save?

For uniform arrays of objects, savings can be substantial, because keys are written once instead of in every record. Nested or irregular data saves less.

Can LLMs understand TOON?

Modern models generally read it well, because it resembles CSV and YAML, but test accuracy for your specific task.

Should I ask the model to answer in TOON?

For output that software must parse, JSON with a schema is usually more reliable.