What is TOON Format?

Complete guide to Token-Oriented Object Notation

Introduction to TOON

TOON (Token-Oriented Object Notation) is a revolutionary data format designed specifically to optimize data for Large Language Models (LLMs) and reduce API costs. It achieves this by minimizing token usage by 30-60% compared to standard JSON while maintaining human readability.

Key Benefits

  • 30-60% token reduction compared to JSON
  • Human-readable with indentation-based structures
  • LLM-optimized with explicit schemas and array lengths
  • Cost-effective for API usage and LLM applications

TOON vs JSON: A Comparison

JSON Example

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

Token count: ~45 tokens

TOON Equivalent

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

Token count: ~18 tokens (60% reduction!)

TOON Format Features

Tabular Array Format

Uniform arrays are represented in a compact tabular format with explicit field headers, eliminating redundant key repetition.

Explicit Array Lengths

Array lengths are explicitly declared, providing clear schemas that enhance parsing reliability in LLMs.

Indentation-Based Structure

Similar to YAML, TOON uses indentation to represent hierarchy, making it both compact and readable.

Minimal Syntax

Removes redundant brackets, braces, and repeated keys, significantly reducing token count.

Use Cases for TOON

LLM Applications

Reduce API costs by sending more data with fewer tokens to language models.

API Optimization

Optimize API payloads to reduce bandwidth and processing costs.

Data Storage

Store structured data more efficiently while maintaining readability.

Configuration Files

Use TOON for configuration files that need to be both compact and human-readable.

Ready to Convert JSON to TOON?

Use our free JSON to TOON converter to transform your JSON data into the compact TOON format and start saving on API costs.