explaingit

toon-format/toon

📈 Trending24,296TypeScriptAudience · developerComplexity · 2/5ActiveLicenseSetup · easy

TLDR

A compact, human-readable data format that replaces JSON to reduce token usage in LLM prompts, saving costs and context space.

Mindmap

mindmap
  root((repo))
    What it does
      Compact JSON alternative
      Schema-aware encoding
      LLM-optimized format
    Why use it
      Lower token costs
      More data per context
      Readable structure
    How to use
      TypeScript SDK
      Define schema first
      Encode structured data
    Tech stack
      TypeScript
      Node.js runtime
    Audience
      LLM app builders
      Cost-conscious teams

Things people build with this

USE CASE 1

Reduce token costs when sending structured data to GPT or Claude APIs by using TOON instead of JSON.

USE CASE 2

Fit more data into an LLM's context window by compressing prompts with schema-aware encoding.

USE CASE 3

Build chatbot or AI agent systems that need to pass structured configuration or records to language models efficiently.

Tech stack

TypeScriptNode.js

Getting it running

Difficulty · easy Time to first run · 5min
Use freely for any purpose including commercial, as long as you keep the copyright notice.

In plain English

TOON (Token-Oriented Object Notation) is a compact, human-readable data format designed as an alternative to JSON, specifically optimized for use in prompts sent to large language models (LLMs) like GPT or Claude. The core problem it addresses is that JSON, while widely used, is verbose, it uses a lot of repeated characters like braces, quotes, and colons that waste tokens. In LLM APIs, you pay per token and models have limited context windows, so a more compact format means lower cost and more data fitting in the same space. TOON is schema-aware, meaning it knows the structure of your data upfront and can omit redundant labels, producing shorter output that still carries the same information. The project includes a specification defining the format and a TypeScript SDK for working with it in code. Benchmarks are included to demonstrate how much more compact TOON is compared to standard JSON. You would use TOON when building applications that feed structured data into LLM prompts and want to reduce token usage without sacrificing readability or structure. It is written in TypeScript.

Copy-paste prompts

Prompt 1
How do I convert my JSON data to TOON format using the TypeScript SDK to reduce tokens in my Claude API calls?
Prompt 2
Show me how to define a schema in TOON and encode a user record to see the token savings versus JSON.
Prompt 3
I have a large dataset I need to send to GPT in a prompt. How would I use TOON to make it more compact while keeping it readable?
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.