TOON to kompaktowy format modelowania danych zaprojektowany dla efektywnej komunikacji z LLM. Multi-language SDK support. Status: Development
Status: 🔄 Development
Goal: LLM-friendly data format
Languages: Python, JavaScript, Go, Rust
TOON (Token-Oriented Object Notation) to kompaktowy format modelowania danych zaprojektowany specjalnie dla:
JSON i YAML są verbose - przy komunikacji z LLM każdy token kosztuje. TOON redukuje zużycie tokenów o 40-60% przy zachowaniu czytelności.
JSON (47 tokenów):
{"user": {"id": 123,"name": "John Doe","email": "john@example.com","roles": ["admin", "user"]}}
TOON (19 tokenów):
user{id:123 name:"John Doe" email:"john@example.com" roles:[admin user]}
Redukcja: 60%
# Komentarzname:"value" # Stringcount:42 # Numberactive:true # Booleanitems:[a b c] # Arraynested{key:val} # Object
api{name:"User API"version:"1.0"base:"/api/v1"endpoints[{GET /users -> User[] "List all users"}{GET /users/:id -> User "Get user by ID"}{POST /users <- UserCreate -> User "Create user"}{PUT /users/:id <- UserUpdate -> User "Update user"}{DELETE /users/:id -> void "Delete user"}]types{User{id:int name:str email:str roles:str[]}UserCreate{name:str email:str}UserUpdate{name:str? email:str?}}}
schema User{id:int @primaryname:str @required @min(1) @max(100)email:str @email @uniqueroles:str[] @default([user])created:datetime @auto}
from toon import parse, dump# Parse TOONdata = parse('user{name:"John" age:30}')print(data) # {'user': {'name': 'John', 'age': 30}}# Generate TOONtoon_str = dump({'user': {'name': 'John', 'age': 30}})print(toon_str) # user{name:"John" age:30}
import { parse, dump } from 'toon-js';const data = parse('user{name:"John" age:30}');console.log(data); // { user: { name: 'John', age: 30 } }const toonStr = dump({ user: { name: 'John', age: 30 } });console.log(toonStr); // user{name:"John" age:30}
| Komponent | Status | Uwagi |
|---|---|---|
| Spec v1.0 | ✅ Complete | Core syntax finalized |
| Python SDK | ✅ Stabilny | PyPI: toon-parser |
| JavaScript SDK | ⚠️ Beta | npm: toon-js |
| Go SDK | 🔄 In Progress | Q1 2026 |
| Rust SDK | ⏳ Planned | Q2 2026 |
| VS Code Extension | ⚠️ Beta | Syntax highlighting |
| JSON Schema Conv | ✅ Stabilny | Bidirectional |
| OpenAPI Conv | 🔄 In Progress | Import only |
prompt{system:"You are a helpful assistant"context{user_prefs{lang:pl theme:dark}}history[{role:user msg:"Hello"}{role:assistant msg:"Hi! How can I help?"}]}
endpoint{method:POSTpath:"/orders"auth:bearerbody{product_id:int qty:int}response{order_id:int status:str}errors[400:"Invalid input" 401:"Unauthorized"]}
config{app{name:"MyApp" env:production}db{host:"localhost" port:5432 pool:10}cache{driver:redis ttl:3600}features{dark_mode:true beta:false}}
| Format | Tokens | Reduction vs JSON |
|---|---|---|
| JSON | 100 | baseline |
| YAML | 85 | 15% |
| TOML | 80 | 20% |
| TOON | 42 | 58% |
| Language | JSON | TOON |
|---|---|---|
| Python | 45,000 | 38,000 |
| JavaScript | 120,000 | 95,000 |
| Go | 280,000 | 250,000 |
TOON is ~15-20% slower than JSON parsing, but the token savings offset this for LLM use cases.
Ostatnia aktualizacja: 10 lutego 2026