Documentation

Everything you need to know about Token-Oriented Object Notation

What is TOON?

TOON (Token-Oriented Object Notation) is a compact data format designed specifically to reduce token usage in Large Language Model (LLM) applications. It achieves 30-60% token reduction compared to JSON while maintaining full data fidelity and human readability.

30-60% Smaller

Significantly reduces LLM API costs

100% Private

All conversions run in your browser

Lossless

Perfect round-trip conversion

Quick Example

JSON

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

TOON

34 tokens
users[2]{id,name,role}:
  1,Alice,admin
  2,Bob,user
✓ 62% reduction (55 tokens saved)

Key Features

Compact Syntax

Removes unnecessary brackets, quotes, and whitespace while preserving structure

Type Inference

Automatically detects numbers, booleans, and null values

Array-First Design

Optimized for tabular data and arrays of objects (common in APIs)

Human Readable

Easy to read and understand, similar to CSV but more powerful

Perfect For

LLM Applications

  • Reduce ChatGPT API costs
  • Claude context optimization
  • GPT-4 token efficiency
  • Few-shot learning examples

Data Processing

  • API response formatting
  • Database exports
  • Log file compression
  • Configuration files

Your Privacy is Guaranteed

All TOON Tools run 100% client-side in your browser. Your data never touches our servers or any third-party services.

  • No data is uploaded or stored
  • Works completely offline
  • No analytics or tracking
  • Open source and auditable

Use in Your Projects

Install the official TOON library via npm:

npm install @toon-format/toon
import { encode, decode } from '@toon-format/toon'

// Convert to TOON
const toon = encode({ users: [{ id: 1, name: 'Alice' }] })

// Convert back to JSON
const json = decode(toon)