explaingit

toon-format/toon

Analysis updated 2026-05-18

24,138TypeScriptAudience · developerComplexity · 2/5LicenseSetup · 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
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

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.

What is it built with?

TypeScriptNode.js

How does it compare?

toon-format/toonfelixrieseberg/windows95qwenlm/qwen-code
Stars24,13824,12624,206
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasyeasymoderate
Complexity2/52/52/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get 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?

Frequently asked questions

What is toon?

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

What language is toon written in?

Mainly TypeScript. The stack also includes TypeScript, Node.js.

What license does toon use?

Use freely for any purpose including commercial, as long as you keep the copyright notice.

How hard is toon to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is toon for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub toon-format on gitmyhub

Verify against the repo before relying on details.