Skip to main content

Token-Oriented Object Notation

TOON is a compact, human-readable encoding of JSON optimized for LLM prompts. Save up to 40% on tokens while maintaining 100% lossless conversion.

Why TOON?

LLM tokens cost money, and standard JSON is verbose. TOON combines YAML-like indentation with CSV-style tabular arrays to minimize token usage while remaining perfectly readable and maintaining full JSON compatibility.

Token Efficient

Save ~40% tokens compared to formatted JSON while achieving 76.4% accuracy vs JSON’s 75%

Lossless

100% bidirectional conversion between JSON and TOON with deterministic round-trips

LLM-Friendly

Explicit length declarations and field headers provide clear schema guardrails

Quick Example

Transform verbose JSON into compact TOON format:

Key Features

TypeScript SDK

Full-featured encode/decode APIs with TypeScript types

Streaming Support

Memory-efficient processing for large datasets

CLI Tool

Quick conversions and token analysis from command line

Benchmarks

Proven 76.4% accuracy across 4 LLMs and 209 test questions

Get Started

1

Install the package

2

Encode your first data

3

Decode back to JSON

When to Use TOON

TOON excels with uniform arrays of objects, making it ideal for:
  • πŸ“Š Tabular data with consistent structure (employee records, analytics, logs)
  • πŸ€– LLM prompts where token efficiency matters
  • πŸ“ˆ Time-series data with repeated field patterns
  • πŸ”„ Data pipelines requiring lossless JSON transformation
For deeply nested or non-uniform structures, compact JSON may be more efficient. See When to Use for detailed guidance.

Next Steps

Quickstart Guide

Get up and running in 5 minutes

Format Overview

Learn TOON syntax and structure

API Reference

Explore all encode/decode functions

LLM Integration

Use TOON with Claude, GPT, and other models