toon-format

toon: Encode JSON Compactly for LLM Prompts

TOON is a human-readable encoding of JSON designed to reduce prompt tokens while preserving structure. Its TypeScript SDK and CLI suit teams sending uniform records to LLMs, though deeply nested data may be more efficient in JSON.

ActiveTypeScriptMITLibraryCLIJSON Serialization
View on GitHub Compare
Stars
25.5k
Forks
1.1k
Stars, last 30 days
+124
Last commit
today
Contributors
47

Our take

Activeregular commits and releases

Health score

58/100

How it is scored
Activity
82
Community
46
Issues
54
Pull requests
49

+124 stars in the last 30 days

  • Releases more often than 80% of the projects we track

TOON is a practical, actively maintained format and toolkit for reducing prompt size on uniform JSON data, with adoption risk from its concentrated contributor base and format-specific trade-offs.

Good fit if

  • Your prompts contain arrays or keyed maps of similarly shaped records, where TOON's tabular representation is designed to help.
  • You want a TypeScript SDK or CLI for JSON/TOON conversion in a Node.js workflow.
  • You can evaluate token savings and model behavior on your own data; the repository reports results but notes that tokenizer and model outcomes vary.

Look elsewhere if

  • Your data is deeply nested or highly non-uniform, since the project says compact JSON may be more efficient in those cases.
  • Your data is purely tabular and minimum size is the priority, since the repository notes CSV is smaller.
  • Your team requires a format with broad existing infrastructure rather than adding a newer, evolving serialization format to its prompt pipeline.
All health signals
Last commit2026-10-06 (today)
Commits, last 90 days100+
Releases, last 12 months31 (latest v4.1.1, 2026-08-05)
Contributors47 (top contributor: 89% of commits)
Issues closed, last 90 days14 (typically closed in 14 days)
Project age12 months

Checked on 2026-10-07 with the GitHub API.

Project history

Daily GitHub snapshots since Oct 7, 2026. History covers stars and forks; health signals are not tracked historically.

Selected snapshot

Stars

25,638

Forks

1,126

Change since Nov 17, 2026: +3 stars·0 forks

Overview

TOON encodes the JSON data model in a compact text format aimed at LLM prompts. It combines indentation for nested objects with CSV-like rows for uniform records, reducing repeated structural syntax while keeping field names and row counts explicit.

It is most useful when data has repeated, consistent fields, such as arrays of records or maps of similarly shaped objects. The repository includes a TypeScript SDK and CLI for converting between JSON and TOON; the project also documents cases where compact JSON or CSV can be a better fit.

Key Features

  • Lossless conversion between JSON-compatible values and TOON.
  • Tabular encoding declares record fields once, then represents each item as a row.
  • Inline and keyed tabular forms cover primitive arrays and maps of uniform objects.
  • Declared lengths and field lists provide structural cues that can help models detect malformed or truncated data.
  • TypeScript SDK includes line-oriented encoding and streaming decode APIs.
  • CLI converts JSON and TOON, works with standard input and output, and can report token estimates.
  • Delimiter options include comma, tab, and pipe.

Use Cases

  • LLM application developers can encode uniform records before adding them to prompts, especially when prompt-token budgets matter.
  • Data and analytics teams can share repeated event or time-series records with a model without repeating object syntax for every row.
  • Developers building JSON-based tool integrations can convert tool responses to TOON before presenting them to an LLM.
  • TypeScript teams can add JSON-to-TOON conversion to a Node.js application or use the CLI in data-processing pipelines.

What you need

Detected in the repository

  • Node.js (from package.json)
  • Automated checks on GitHub Actions

License in plain words

MITpermissive

  • Commercial use: yes
  • Modify and redistribute: yes
  • You must keep: the copyright and license notice
  • Share your changes: no

A summary, not legal advice: the LICENSE file is what applies.

Getting Started

Install the TypeScript package:

npm install @toon-format/toon

See the README for SDK examples, CLI usage, and documentation links.

Considerations

  • The format is described as stable but still open to change through its specification, so teams should account for format evolution and interoperability when adopting it.
  • Token savings depend on data shape. The repository identifies deeply nested and non-uniform structures as cases where JSON can be more efficient, and flat tables as cases where CSV can be smaller.
  • Published benchmark figures use a specific tokenizer and test set; actual token counts and model accuracy can differ across providers and workloads. Latency also needs to be measured in the target environment.
  • The project is active, with regular commits and releases and issues being closed, but code contributions are highly concentrated in one contributor despite participation from a broader group.
  • The SDK requires Node.js. The provided requirements list CI but no test-suite indicator, so teams should review validation and conformance needs before relying on it in production.

Found this useful?

Share it with someone who would like toon.