https://github.com/zoon-format/zoon
ZOON - Zero Overhead Object Notation, token-optimized data format to maximize LLM context window efficiency.
https://github.com/zoon-format/zoon
ai format json llm notation optimization token toon zon zoon
Last synced: 8 days ago
JSON representation
ZOON - Zero Overhead Object Notation, token-optimized data format to maximize LLM context window efficiency.
- Host: GitHub
- URL: https://github.com/zoon-format/zoon
- Owner: zoon-format
- License: mit
- Created: 2025-12-28T20:37:16.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2025-12-29T05:46:50.000Z (about 2 months ago)
- Last Synced: 2025-12-31T13:39:05.156Z (about 2 months ago)
- Topics: ai, format, json, llm, notation, optimization, token, toon, zon, zoon
- Language: TypeScript
- Homepage: https://zoonformat.org
- Size: 28.7 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Zero Overhead Object Notation (ZOON)
[](./SPEC.md) 
**Zero Overhead Object Notation (ZOON)** is a token-optimized data format designed to maximize **LLM Context Window efficiency**. It removes all redundancy from your data, achieving token compression rates superior to JSON, TOON, ZON, and CSV. Written by Carsen Klock.

## Why ZOON?
LLM Context Tokens cost money. Standard JSON is verbose. ZOON is **optimal**.
### Token Benchmarks (GPT-5 Tokenizer)
| Format | Tokens | Savings vs JSON |
| :------- | --------: | --------------: |
| **ZOON** | **6,274** | **60%** |
| ZON | 7,840 | 50% |
| TOON | 8,630 | 45% |
| JSON | 15,685 | — |
### Key Features
| Feature | Description |
| --------------------- | ---------------------------------------------------------- |
| **Indexed Enums** | `field!opt1\|opt2` uses numeric indices for compact output |
| **Header Aliasing** | `%a=long.prefix` reduces nested redundancy |
| **Constant Hoisting** | `@field=value` moves repeated values to header |
| **Auto-Increment** | `i+` type or `+N` count for implicit rows |
| **Boolean Shorthand** | `1`/`0` (tabular) or `y`/`n` (inline) |
| **Space Delimiters** | More token-efficient than commas or pipes |
| **Dual Format** | Tabular (arrays) and Inline (objects) |
### ZOON vs TOON
| Feature | TOON | ZOON |
| -------------- | ------------------- | -------------------------- |
| Delimiter | Pipes `\|` / Commas | Spaces |
| Nested Data | ❌ Flattened only | ✅ Aliasing & Unflattening |
| Auto-increment | ❌ Must include IDs | ✅ `i+` or `+N` |
| Single objects | ❌ Arrays only | ✅ Inline `{...}` |
| Type Safety | ❌ None | ✅ Header validated |
## Installation
```bash
bun add @zoon-format/zoon
```
### CLI
```bash
npm install -g @zoon-format/cli
zoon input.json -o output.zoon --stats
```
## Quick Start
```typescript
import { encode, decode } from "@zoon-format/zoon";
// Arrays → Tabular format
const users = [
{ id: 1, role: "Admin", active: true },
{ id: 2, role: "User", active: true },
{ id: 3, role: "User", active: false },
];
console.log(encode(users));
// # id:i+ role=Admin|User active:b
// Admin 1
// User 1
// User 0
// Objects → Inline format
const config = {
server: { host: "localhost", port: 3000, ssl: true },
features: { darkMode: true, analytics: false },
};
console.log(encode(config));
// server:{host=localhost port:3000 ssl:y} features:{darkMode:y analytics:n}
```
## Format Overview
### Tabular Format (Arrays)
```
# id:i+ name:s role=Admin|User active:b
Alice Admin 1
Bob User 1
Carol User 0
```
**Types:**
| Code | Type | Description |
|------|------|-------------|
| `s` | String | Spaces → `_` |
| `i` | Integer | Whole numbers |
| `b` | Boolean | `1`/`0` |
| `i+` | Auto-Increment | Omitted from body |
| `a` | Array | `[a,b,c]` |
**Compression:**
| Marker | Meaning |
|--------|---------|
| `"` | Same as row above |
| `>` | Previous + 1 |
| `~` | Null |
### Inline Format (Objects)
```
server:{host=localhost port:3000 ssl:y} db:{driver=postgres port:5432}
```
| Pattern | Type |
| ----------------- | ------------- |
| `key=val` | String |
| `key:123` | Number |
| `key:y` / `key:n` | Boolean |
| `key:~` | Null |
| `key:{...}` | Nested Object |
| `key:[a,b]` | Array |
## CLI Usage
```bash
# Encode JSON to ZOON
zoon input.json -o output.zoon
# Decode ZOON to JSON
zoon data.zoon -o output.json
# Show token savings
zoon data.json --stats
```
## Packages
| Package | Description | Link |
| ------------------- | -------------------------- | -------------------------------------------------- |
| `@zoon-format/zoon` | Core encode/decode library | [npm](https://npmjs.com/package/@zoon-format/zoon) |
| `@zoon-format/cli` | Command-line interface | [npm](https://npmjs.com/package/@zoon-format/cli) |
| `zoon-format` | Python bindings | [PyPI](https://pypi.org/project/zoon-format/) |
| `zoon-go` | Go module | [GitHub](https://github.com/zoon-format/zoon-go) |
| `zoon-format` | Rust Crate | [crates.io](https://crates.io/crates/zoon-format) |
## Links
- [Full Specification](./SPEC.md)
- [Playground](https://zoonformat.org)
## License
MIT © 2025-PRESENT Carsen Klock