What is TOON?
What is TOON? How Token-Oriented Object Notation works under the hood ?
What is Toon?
TOON is a new data serialization format designed with a code objective:
Reduce the number of tokens when exchanging structured data with language models.
While JSON uses verbose syntax with braces, quotes, and commas, TOON relies on a token-efficient tabular style, which is much closer to how LLMs naturally understand structured data.
The name “Toon” sometimes refers to “Typed Object Optimized Notation,” a modern approach where every field has a known type and is stored in an optimized binary layout, similar to formats like MessagePack, Protocol Buffers, Avro, or CBOR — but typically simpler and even lighter.
In simple terms:
Toon = JSON with strict types + binary encoding + zero waste.
Let’s make a quick comparison between JSON and TOON:
Here is some JSON with a users array that contains information about two users (two objects):
{
"users": [
{ "id": 1, "name": "Alice", "role": "admin" },
{ "id": 2, "name": "Bob", "role": "user" }
]
}
If you wanted to represent the same data in TOON, it would look like this:
users[2]{id,name,role}:
1,Alice,admin
2,Bob,userJSON vs Toon: Why JSON Becomes a Bottleneck
## 1. JSON is Text-Based (Slow to Parse)
JSON parsing requires:
reading characters
scanning strings
converting "123" into an integer
converting "true" into a boolean
sanitizing special characters
These steps cost CPU cycles and block event loops in Node.js, Python, or Go if you parse large payloads.
Toon, being binary, doesn't need string parsing at all.
## 2. JSON is Verbose (Large Size)
Size:
-
JSON: ~52 bytes
-
Toon (binary): ~16 bytes
With Toon:
-
field names are not repeated
-
numbers are stored as binary integers (4 bytes)
-
booleans are stored as 1 byte
-
strings are length-prefixed
On large datasets, Toon commonly reduces size by 40–70%.
## 3. JSON Has No Native Types
Everything in JSON is text:
-
"123"→ must be parsed into a number -
"true"→ parsed into boolean -
"2024-01-01"→ must be parsed into date -
"3.14"→ parsed to float
Toon stores typed values directly:
-
int32
-
uint64
-
float
-
bool
-
string
-
map
-
array
-
binary blob
-
datetime
No conversion step → faster processing.
## 4. JSON Requires More Memory
JSON parsing creates intermediate objects, especially in JavaScript, Python, or Java.
Toon decodes directly into typed memory structures (like Protobuf or MessagePack).
This reduces:
-
GC pressure
-
CPU usage
-
memory overhead
-
latency spikes
Performance Comparison
| Operation | JSON | Toon |
|---|---|---|
| Size | 100% | 30–60% smaller |
| Serialization speed | Slow (string building) | Very fast (binary write) |
| Deserialization speed | Slow (character parsing) | Extremely fast (binary read) |
| CPU usage | High | Low |
| Memory usage | High | Low |
| Streaming support | Limited | Excellent |
| Suitable for real-time | ❌ No | ✅ Yes |
Where Toon Is Used (Real Use-Cases)
1. Real-Time Messaging Systems
- Toon-like binary formats are used in:
-
WhatsApp
-
Telegram
-
Zoom / WebRTC metadata
-
Online games (Unity, Unreal)
-
IoT devices
Because binary is much faster and smaller than JSON.
2. Microservices with High Throughput
Companies like:
-
Netflix
-
Uber
-
Google
-
Cloudflare
use binary formats between internal services to reduce CPU and bandwidth usage.
3. Edge Computing & CDNs
On edge workers (like Cloudflare Workers), binary formats reduce:
-
cold start time
-
memory limits
-
CPU billing
4. AI, ML & Vector Stores
JSON is too slow for numeric-heavy workloads (embeddings, tensors, statistics).
Why Toon Is Efficient: The Core Principles
1. Binary, Not Text
No unnecessary quotes or parsing.
2. Typed Fields
No need to convert "123" → number.
3. Compact Field Schema
Field names are stored once or not needed at all.
4. Predictable Layout
Much easier and faster for machines to process.
5. Works Well Over Network
Small payload → lower latency.
Conclusion: JSON Is Good — but Toon Is Better
JSON is not going away.
It's:
-
easy
-
human-readable
-
great for APIs
-
simple for frontend apps
But JSON is also:
-
slow to parse
-
heavy to transfer
-
not type-safe
-
inefficient at scale
Toon is the next step: a lightweight, typed, binary format designed for speed and efficiency.
If you're building:
-
real-time apps
-
microservices
-
high-performance backends
-
low-latency communication
-
data-heavy pipelines
You should absolutely consider switching from JSON to Toon)))
In our next blog we will try building a simple chatapp using toon
Share this article
