toons
A high-performance TOON (Token Oriented Object Notation) parser and serializer for Python, implemented in Rust.
What it is and what it does
toons is a Python library that parses and serializes data in TOON format, a compact token-efficient notation designed to reduce token consumption in LLM contexts by 30-60% compared to JSON. It wraps a Rust implementation via PyO3 bindings and exposes a json-like API (loads, dumps, load, dump) so developers familiar with the standard library can adopt it with minimal friction. The package also includes conversion utilities to translate between TOON and JSON.
The library targets use cases where token count directly impacts cost or context capacity—primarily LLM applications, prompt engineering, and data serialization for AI systems. It supports standard Python types and is spec-compliant with TOON Specification v3.0. Installation is straightforward on modern platforms via prebuilt wheels, though some architectures may require a Rust compiler.
Use it for:
- Reduce token consumption in LLM prompts and responses by serializing structured data in TOON instead of JSON.
- Build prompt templates and few-shot examples that fit within tighter token budgets for cost-sensitive LLM APIs.
- Convert between TOON and JSON formats in data pipelines serving both LLM and non-LLM consumers.
- Store and transmit structured configuration or metadata in LLM-adjacent workflows where token efficiency matters.
- Prototype or migrate existing json-based code to TOON with minimal refactoring due to the familiar API.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
toons is a Rust-backed Python parser and serializer for the TOON (Token Oriented Object Notation) format, a token-efficient data serialization designed for LLM contexts, with an API mirroring the standard json module.
Yes, with conditions. Install if you work with LLMs and need to reduce token consumption in serialized data—the token savings (30-60% vs JSON) are real and the json-like API lowers adoption friction. Verify the license (marked unclear in metadata despite Apache 2.0 in the description) before use in proprietary code. Medium install friction is acceptable for most modern Python environments, and the package is actively maintained with no known vulnerabilities.
Install
toons on PyPI
pip
pip install toonsuv
uv add toonspoetry
poetry add toonsInstalling toons
Before you install
Medium install friction due to compiled Rust bindings, but wheels are available for modern Python on common platforms (cp37-abi3 and cp314 variants for x86_64, aarch64, and ARM64). Package is actively maintained with recent commits and no known vulnerabilities.
License in practice
License treatment is unclear—the description excerpt mentions Apache License 2.0, but the fact sheet records license_spdx and license_raw as null with treatment marked unclear. Verify the actual license before relying on this package in proprietary or restricted contexts.
Quickstart
pip install toons
import toons
data = toons.loads("name: Alice\nage: 30")
print(data) # {'name': 'Alice', 'age': 30}
user = {"name": "Bob", "age": 25}
print(toons.dumps(user))
Requires Python >=3.7; binary wheels available for modern x86_64, aarch64, and ARM64 platforms, but older or less common architectures may require a Rust compiler to build from source.
Verify before relying
- Actual license SPDX identifier and full license text (description says Apache 2.0 but metadata is null).
- Real-world performance gains and token reduction percentages on typical LLM workloads beyond the documented 30-60% range.
- Stability and breaking-change history across minor versions since first release in 2025-11-01.
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 85 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 7,894,093/month — #1,684 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: toons-0.7.0-cp314-cp314t-macosx_10_12_x86_64.whl; toons-0.7.0-cp314-cp314t-macosx_11_0_arm64.whl; toons-0.7.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; toons-0.7.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; toons-0.7.0-cp314-cp314t-musllinux_1_2_aarch64.whl; toons-0.7.0-cp314-cp314t-musllinux_1_2_x86_64.whl; toons-0.7.0-cp314-cp314t-win_amd64.whl; toons-0.7.0-cp314-cp314t-win_arm64.whl; toons-0.7.0-cp37-abi3-macosx_10_12_x86_64.whl; toons-0.7.0-cp37-abi3-macosx_11_0_arm64.whl; toons-0.7.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; toons-0.7.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; toons-0.7.0-cp37-abi3-musllinux_1_2_aarch64.whl; toons-0.7.0-cp37-abi3-musllinux_1_2_x86_64.whl; toons-0.7.0-cp37-abi3-win_amd64.whl; toons-0.7.0-cp37-abi3-win_arm64.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
python-toonEncodes and decodes TOON (Token-Oriented Object…
permissive · top 15,000 on PyPI
toon-formatEncodes and decodes data structures using TOON…
permissive · top 15,000 on PyPI
json-tools-rsFlattens and unflattens nested JSON structures…
permissive · top 15,000 on PyPI
toml-rsA high-performance TOML parser and serializer…
permissive · top 15,000 on PyPI
fastokensfastokens is a high-performance BPE tokenizer…
unclear · top 15,000 on PyPI
json-flattenConverts nested JSON objects into flat…
permissive · top 15,000 on PyPI
json-stream-rs-tokenizerA Rust-based JSON tokenizer that accelerates…
unclear · top 5,000 on PyPI
typed-json-dataclassAdds JSON serialization and type validation to…
permissive · top 15,000 on PyPI
canoserCanoser implements canonical serialization for…
permissive · top 15,000 on PyPI