September 3, 2026 · 1 min read · Yunus Emre Vurgun

Cutting Prompt Tokens with TOON: A Worked Example

toon · tokens · tutorial
In this guide
  1. The numbers
  2. What changes
  3. Try it

TOON (Token-Oriented Object Notation) removes the repeated keys that make JSON expensive in prompts. Here is the effect on a real dataset — TCP/IP Protocol Suite — fetched live from this site.

The numbers

  • JSON payload: 847 bytes
  • TOON payload: 464 bytes (−45%)
  • Across all 185 datasets, TOON uses 32% fewer tokens than the JSON files we serve, and more on table-shaped data (see the measured comparison)

What changes

JSON repeats "layer" and "protocols" on every row. TOON declares the shape once — [4]{layer,protocols} — then lists bare rows. Same facts, no repeated keys, tabular layout models parse cleanly.

data[4]{layer,protocols}:
  Application,"HTTP, HTTPS, FTP, SMTP, DNS, SSH"
  Transport,"TCP, UDP"
  Internet,"IP, ICMP, ARP, IGMP"
  Network Access,"Ethernet, Wi-Fi, PPP"

Try it

Append ?format=toon to any dataset URL — for example /api/dataset/tcp-ip-protocol-suite?format=toon — and compare against ?format=json. Every endpoint in the API docs supports all three formats, and the homepage showdown visualizes the difference.

Search the library

Search by a topic, title, or keyword.

Start with a collection

Browse all 205 datasets