toon-rs
Library Listed Dormant
Token-Oriented Object Notation – a token-efficient JSON alternative for LLM prompts
- Downloads
- 8,018
- Dependents
- 5
- Stars
- 22
- Forks
- 1
- Contributors
- 0
- Commits
- 7
- Latest release
- 0.1.2 ·
About
TOON (Token-Oriented Object Notation) - Rust
A Rust implementation of Token-Oriented Object Notation (TOON), a compact, human-readable format designed for passing structured data to Large Language Models with significantly reduced token usage.
This is a Rust port of the original JavaScript/TypeScript implementation: @byjohann/toon.
Why TOON?
LLM tokens cost money, and standard JSON is verbose. TOON conveys the same information with 30-60% fewer tokens than JSON:
JSON (257 tokens):
{
"users": [
{ "id": 1, "name": "Alice", "role": "admin" },
{ "id": 2, "name": "Bob", "role": "user" }
]
}
TOON (166 tokens):
users[2]{id,name,role}:
1,Alice,admin
2,Bob,user
Installation
Add this to your Cargo.toml:
[dependencies]
toon = "0.1.0"
serde_json = "1.0"
Quick Start
use toon::encode;
use serde_json::json;
fn main() {
let data = json!({
"user": {
"id": 123,
"name": "Ada",
"tags": ["reading", "gaming"],
"active": true
}
});
let toon_output = encode(&data, None);
println!("{}", toon_output);
}
Output:
user:
active: true
id: 123
name: Ada
tags[2]: reading,gaming
Read the full README
Features
- 💸 Token-efficient: 30–60% fewer tokens than JSON
- 🍱 Minimal syntax: removes redundant punctuation
- 📐 Indentation-based structure: like YAML
- 🧺 Tabular arrays: declare keys once, stream rows
- 🦀 Type-safe: built with Rust's strong type system
Examples
Objects
use toon::encode;
use serde_json::json;
let data = json!({
"id": 123,
"name": "Ada",
"active": true
});
println!("{}", encode(&data, None));
Output:
active: true
id: 123
name: Ada
Arrays of Objects (Tabular Format)
let data = json!({
"items": [
{ "sku": "A1", "qty": 2, "price": 9.99 },
{ "sku": "B2", "qty": 1, "price": 14.5 }
]
});
println!("{}", encode(&data, None));
Output:
items[2]{price,qty,sku}:
9.99,2,A1
14.5,1,B2
Custom Delimiters
Use tab or pipe delimiters for even more token savings:
use toon::{encode, EncodeOptions, Delimiter};
let data = json!({
"tags": ["reading", "gaming", "coding"]
});
let mut options = EncodeOptions::default();
options.delimiter = Delimiter::Tab;
println!("{}", encode(&data, Some(options)));
Output:
tags[3 ]: reading gaming coding
Length Markers
Add a # prefix to array lengths for clarity:
let mut options = EncodeOptions::default();
options.length_marker = Some('#');
let data = json!({"tags": ["a", "b", "c"]});
println!("{}", encode(&data, Some(options)));
Output:
tags[#3]: a,b,c
API
encode(value: &serde_json::Value, options: Option<EncodeOptions>) -> String
Converts a serde_json::Value to TOON format.
Parameters:
value: A reference to aserde_json::Valueto encodeoptions: Optional encoding options (defaults to standard TOON format)
Returns: A String containing the TOON-formatted output
EncodeOptions
pub struct EncodeOptions {
pub indent: usize, // Spaces per indentation level (default: 2)
pub delimiter: Delimiter, // Delimiter for arrays (default: Comma)
pub length_marker: Option<char>, // Optional length prefix (default: None)
}
Delimiter
pub enum Delimiter {
Comma, // ,
Tab, // \t
Pipe, // |
}
Format Overview
- Objects:
key: valuewith 2-space indentation for nesting - Primitive arrays: Inline with count, e.g.,
tags[3]: a,b,c - Arrays of objects: Tabular format with header, e.g.,
items[2]{id,name}: - Mixed arrays: List format with
-prefix - Quoting: Only when necessary (special chars, structural ambiguity)
Python Bindings
Python bindings are available in the pybinding/ directory.
Installation
pip install toon-pyrs
Or build from source:
cd pybinding
pip install maturin
maturin build --release
pip install target/wheels/*.whl
Python Usage
import json
import toon
data = {
"users": [
{"id": 1, "name": "Alice", "role": "admin"},
{"id": 2, "name": "Bob", "role": "user"}
]
}
result = toon.encode(json.dumps(data))
print(result)
Output:
users[2]{id,name,role}:
1,Alice,admin
2,Bob,user
Publishing Python Package
cd pybinding
maturin build --release
pip install twine
twine upload target/wheels/*
License
MIT License © 2025
See Also
Original JS/TS implementation: @byjohann/toon
Compatibility
- Runs on
- GPU support unknown
What shows it
- no dependency or feature matches a backend row
- Native code
- None found
- No native code found
- Python bindings
- No Python binding crate found
- License
- MIT
Compare with similar projects
Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.
| Project | Downloads | Dependents | Stars | Latest release | Runs on (GPU) | Native code | License |
|---|---|---|---|---|---|---|---|
|
Token-Oriented Object Notation – a token-efficient JSON alternative for LLM prompts |
8,018 downloads over 30 days | 5 | 22 | 0.1.2 | GPU support unknown | No native code found | MIT |
|
pdf_oxide Featured
The fastest Rust PDF library — 0.8ms mean, 5× faster than the industry leaders, 100% pass rate on 3,830 real-world PDFs. Text extraction, Markdown/HTML conversion, PDF creation and editing. Python bindings |
316,729 downloads over 30 days | 30 | 1,180 | 0.3.78 | GPU support unknown | Binds native code: aws-lc-rs (feature fips), lcms2-sys (feature icc-lcms2), ort-sys (feature gpu) | Apache-2.0 OR MIT |
|
toon-rust Featured
Token-Oriented Object Notation (TOON) - a token-efficient JSON alternative for LLM prompts |
160,383 downloads over 30 days | 67 | 190 | 0.7.0 | GPU support unknown | No native code found | MIT |
|
Pure Rust PDF library for AI/RAG: structure-aware chunking, no ML, no C deps. |
62,285 downloads over 30 days | Not applicable | 194 | 5.5.7 | GPU support unknown | No native code found | MIT |
|
serde_toon Listed
A Serde-compatible TOON (Token-Oriented Object Notation) serialization library |
2,384 downloads over 30 days | 4 | 13 | 0.3.0 | GPU support unknown | No native code found | Apache-2.0 OR MIT |
|
Inference server for LLMs, speech and embeddings: OpenAI-compatible routes with streaming, plus speech synthesis (TTS) and transcription (ASR). Serves Llama, Mistral, Qwen, Mamba2, MLA+MoE and hybrid models from SafeTensors, AWQ, GPTQ and GGUF. |
8 binary downloads per release | Not applicable | 7 | 0.7.1 | CUDA, WebGPU | Binds native code: ring (feature distributed) | Apache-2.0 |
|
Vision infrastructure to turn complex documents into LLM-ready data |
0 binary downloads per release | Not applicable | 4,157 | Not measured | Not measured | AGPL-3.0 |
Why ListedNo archive, New or Featured rule places it, so it is Listed.
What it lacks for Featured
- It has 3 active dependents and 3 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 22 stars, 1 fork and 0 contributors. It needs 4,539 stars, 434 forks and 79 contributors together.
- The project is dormant and not finished. Dormancy rule
What else the check found
- The last activity is on 30 Oct 2025, 375 days ago. That reaches the 365 days the rules expect, so the project is dormant. Dormancy rule
- The oldest outside issue waits 357 days for a reply, past the limit of 270. No maintainer replied in 365 days. Rot signals rule
Not measured: Latest release fails cargo check.
Exact rules: Listed, Featured library. The check on applied thresholds version 9.
Every rule outcome, as the check records it
expected-interval: version 0.1.2 base 300, capped at 3 releases = 150, raised to the 365-day floor: E = 365 daysdormancy: last activity 2025-10-30, 375 days ago, E = 365: dormantrot: oldest unanswered issue 357 days (limit 270), no maintainer reply in 365 daysfeatured: not featured: active_users 3 < 11 and new_adopters 3 < 9 and repository route stars 22 (needs 4539), forks 1 (needs 434), contributors 0 (needs 79); dormant and not stablelisted: listed: no archive, new or featured rule applies
Measurements and sources
Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.
Sources6 sources
- Description: the crates.io description
- crates.io database dump, fetched
- RustSec advisory database, fetched
- GitHub repository, fetched
- crates.io package, fetched
- GitHub contributors, fetched
Adoption3 active dependents, 3 new dependents in 365 days1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | 3 | crates.io database dump | Yes | |
| New dependents (365 days) | 3 | crates.io database dump | Yes | |
| Peak active dependents | 3 | crates.io database dump | Yes | |
| Active dependents as a share of the peak | 1 | crates.io database dump | Yes | |
| Binary downloads per release | Not measured | Yes |
MaintenanceLatest human commit: 12 months ago3 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2025-10-30 | GitHub repository | Yes | |
| Latest release | 2025-10-29 | crates.io database dump | Yes | |
| First release | 2025-10-29 | crates.io database dump | Yes | |
| Latest version | 0.1.2 | crates.io database dump | Yes | |
| Days the oldest outside issue waits for a reply | 357 | GitHub repository | Yes | |
| Maintainer replies over 365 days | 0 | GitHub repository | Yes | |
| Repository archived | false | GitHub repository | Yes | |
| Repository gone | false | GitHub repository | Yes | |
| Release commit or manifest in the repo | true | crates.io package | Yes | |
| Published docs | true | crates.io database dump | Yes | |
| Latest release fails cargo check | Not measured | Yes | ||
| Build check date | Not measured | Yes | ||
| Build check toolchain | Not measured | Yes |
SecurityUnpatched vulnerabilities: none
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Unpatched vulnerabilities past the grace window | none | RustSec advisory database | Yes | |
| RustSec unmaintained advisory | none | RustSec advisory database | Yes | |
| Deprecation notice | none | crates.io database dump | Yes | |
| Deprecated requirement | none | crates.io database dump | Yes |
Distribution3 releases, 8,018 downloads over 30 days5 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | 3 | crates.io database dump | Yes | |
| Downloads over 30 days | 8018 | crates.io database dump | Yes | |
| Binary downloads over the last 3 releases | Not measured | Yes | ||
| Homebrew installs on request over 365 days | Not measured | Yes | ||
| Repology repository families | Not measured | Yes | ||
| Docker pull growth over 90 days | Not measured | Yes | ||
| Docker pulls at the growth baseline | Not measured | Yes | ||
| Every version a prerelease | false | crates.io database dump | Yes | |
| Every version 0.0.x | false | crates.io database dump | Yes | |
| Every version yanked | false | crates.io database dump | Yes | |
| Crate deleted from crates.io | false | crates.io database dump | Yes |
Repository22 stars, 1 forks, 0 contributors, 7 commits. Stars alone never qualify a project.
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 22 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 1 | GitHub repository | Yes — one part of the repository route | |
| Contributors with a GitHub account | 0 | GitHub contributors | Yes — one part of the repository route | |
| Commits on the default branch | 7 | GitHub repository | No | |
| Repository's main crate left out of the entry | none | crates.io database dump | Yes |
Facts that never count
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| License | MIT | crates.io database dump | No | |
| Runs on, from listed crates and their direct dependencies | GPU support unknown | crates.io database dump | No | |
| What shows each backend | no dependency or feature matches a backend row | crates.io database dump | No | |
| Native code, from listed crates and their dependencies | No native code found | crates.io database dump | No | |
| Python bindings, from direct dependencies of listed crates | No Python binding crate found | crates.io database dump | No | |
| Crates that depend on a listed crate directly | 5 | crates.io database dump | No |
Corrections and review history
No correction applies to this entry.
Judgments
A judgment enters only through an approved issue and a merged pull request.
No judgment applies to this entry.