serde_toon

Library Listed

A Serde-compatible TOON (Token-Oriented Object Notation) serialization library

Checked · Sources

Downloads
2,384
Dependents
4
Stars
13
Forks
1
Contributors
2
Commits
4
Latest release
0.3.0 ·

About

From the project README ·

A Serde encoder and decoder for TOON, the Token-Oriented Object Notation.

What is TOON?

TOON is a compact encoding of the JSON data model built for LLM prompts: arrays of uniform objects become tables whose field names appear once. serde_toon implements spec v4.1.

JSON, 155 characters:

[
  { "id": 1, "name": "Alice", "email": "alice@example.com", "active": true },
  { "id": 2, "name": "Bob", "email": "bob@example.com", "active": false }
]

TOON, 89 characters:

[2]{id,name,email,active}:
  1,Alice,alice@example.com,true
  2,Bob,bob@example.com,false

See examples/token_efficiency.rs.

Quick start

[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_toon = "0.3"
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, PartialEq)]
struct User {
    id: u32,
    name: String,
    tags: Vec<String>,
}

fn main() -> Result<(), serde_toon::Error> {
    let user = User { id: 7, name: "Ada".into(), tags: vec!["admin".into(), "ops".into()] };

    let toon = serde_toon::to_string(&user)?;
    assert_eq!(toon, "id: 7\nname: Ada\ntags[2]: admin,ops");

    let back: User = serde_toon::from_str(&toon)?;
    assert_eq!(back, user);
    Ok(())
}
Read the full README

Dynamic values

use serde_toon::toon;

fn main() -> Result<(), serde_toon::Error> {
    let data = toon!({
        "users": [
            {"id": 1, "name": "Alice"},
            {"id": 2, "name": "Bob"}
        ],
        "active": true
    });
    println!("{}", serde_toon::to_string(&data)?);
    Ok(())
}

See examples/dynamic_values.rs and examples/macro.rs.

Strict decoding

from_str is lenient. For untrusted or LLM-generated input, strict mode enforces the spec's validation rules and reports where the input went wrong:

use serde_toon::{from_str_with_options, DecodeOptions, Value};

fn main() {
    // The header declares 3 rows but only 2 follow.
    let input = "users[3]{id,name}:\n  1,Ada\n  2,Bob";
    let err = from_str_with_options::<Value>(input, DecodeOptions::strict()).unwrap_err();
    assert!(err.to_string().contains("line 1"));
}

See examples/strict_decoding.rs.

Features

  • TOON spec v4.1, passing all 538 official conformance tests
  • Full Serde integration: derives, enums, maps, Option, 128-bit integers
  • Zero-copy decoding: &str fields borrow from the input
  • Three decoding modes: strict, lenient, and compatible with 0.2 output
  • Configurable delimiter (comma, tab, pipe) and indentation
  • Errors with line and column
  • No unsafe code; MSRV 1.70

Compatibility with 0.2

The Rust API is unchanged, but 0.3 writes spec-compliant TOON, so the serialized text differs: there are no [#N] markers, fields keep declaration order, and NaN becomes null. from_str still reads everything 0.2 wrote. See the changelog.

Performance

Encoding and decoding are 2-4.6x faster than 0.2 (changelog). Compared with the official toon-format crate (benches/vs_toon_format.rs):

WorkloadEncodeDecode
Tabular, 10k rows3.3 ms vs 32.7 ms2.7 ms vs 17.9 ms
Nested0.17 ms vs 1.43 ms0.19 ms vs 0.87 ms
Strings0.11 ms vs 0.59 ms0.15 ms vs 0.68 ms

Documentation

https://docs.rs/serde_toon

License

MIT OR Apache-2.0

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
Apache-2.0 OR 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.

serde_toon beside the projects that share a topic with it
ProjectDownloadsDependentsStarsLatest releaseRuns on (GPU)Native codeLicense
serde_toon This page 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
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
oxidizePdf App Listed

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
toon-rs Listed Dormant

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
edgeparse Listed

EdgeParse core library — PDF parsing and structured data extraction

6,764 downloads over 30 days 2 155 0.3.2 GPU support unknown No native code found Apache-2.0
blazr App Listed

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
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 13 stars, 1 fork and 2 contributors. It needs 4,539 stars, 434 forks and 79 contributors together.

What else the check found

  • The last activity is on 30 Sep 2026, 40 days ago. The rules expect an update within 365 days. Dormancy rule

Exact rules: Listed, Featured library. The check on applied thresholds version 9.

Every rule outcome, as the check records it
  • expected-interval: version 0.3.0 base 80, raised to the 365-day floor: E = 365 days
  • dormancy: last activity 2026-09-30, 40 days ago, E = 365: active
  • featured: not featured: active_users 3 < 11 and new_adopters 3 < 9 and repository route stars 13 (needs 4539), forks 1 (needs 434), contributors 2 (needs 79)
  • listed: 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
Adoption3 active dependents, 3 new dependents in 365 days1 not measured
Adoption measurements
SignalValueSourceFetchedCounts
Active dependents3crates.io database dumpYes
New dependents (365 days)3crates.io database dumpYes
Peak active dependents3crates.io database dumpYes
Active dependents as a share of the peak1crates.io database dumpYes
Binary downloads per releaseNot measuredYes
MaintenanceLatest human commit: 40 days ago3 not measured
Maintenance measurements
SignalValueSourceFetchedCounts
Latest human commit2026-09-30GitHub repositoryYes
Latest release2026-09-30crates.io database dumpYes
First release2025-10-29crates.io database dumpYes
Latest version0.3.0crates.io database dumpYes
Days the oldest outside issue waits for a reply0GitHub repositoryYes
Maintainer replies over 365 days0GitHub repositoryYes
Repository archivedfalseGitHub repositoryYes
Repository gonefalseGitHub repositoryYes
Release commit or manifest in the repotruecrates.io packageYes
Published docstruecrates.io database dumpYes
Latest release fails cargo checkNot measuredYes
Build check dateNot measuredYes
Build check toolchainNot measuredYes
SecurityUnpatched vulnerabilities: none
Security measurements
SignalValueSourceFetchedCounts
Unpatched vulnerabilities past the grace windownoneRustSec advisory databaseYes
RustSec unmaintained advisorynoneRustSec advisory databaseYes
Deprecation noticenonecrates.io database dumpYes
Deprecated requirementnonecrates.io database dumpYes
Distribution4 releases, 2,384 downloads over 30 days5 not measured
Distribution measurements
SignalValueSourceFetchedCounts
Releases4crates.io database dumpYes
Downloads over 30 days2384crates.io database dumpYes
Binary downloads over the last 3 releasesNot measuredYes
Homebrew installs on request over 365 daysNot measuredYes
Repology repository familiesNot measuredYes
Docker pull growth over 90 daysNot measuredYes
Docker pulls at the growth baselineNot measuredYes
Every version a prereleasefalsecrates.io database dumpYes
Every version 0.0.xfalsecrates.io database dumpYes
Every version yankedfalsecrates.io database dumpYes
Crate deleted from crates.iofalsecrates.io database dumpYes
Repository13 stars, 1 forks, 2 contributors, 4 commits. Stars alone never qualify a project.
Repository measurements
SignalValueSourceFetchedCounts
GitHub stars13GitHub repositoryYes — one part of the repository route
GitHub forks1GitHub repositoryYes — one part of the repository route
Contributors with a GitHub account2GitHub contributorsYes — one part of the repository route
Commits on the default branch4GitHub repositoryNo
Repository's main crate left out of the entrynonecrates.io database dumpYes
Facts that never count
Facts that never count measurements
SignalValueSourceFetchedCounts
LicenseApache-2.0 OR MITcrates.io database dumpNo
Runs on, from listed crates and their direct dependenciesGPU support unknowncrates.io database dumpNo
What shows each backendno dependency or feature matches a backend rowcrates.io database dumpNo
Native code, from listed crates and their dependenciesNo native code foundcrates.io database dumpNo
Python bindings, from direct dependencies of listed cratesNo Python binding crate foundcrates.io database dumpNo
Crates that depend on a listed crate directly4crates.io database dumpNo

Corrections and review history

Report a correction

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.