v0.1.2 — Full TOON spec v1.5 support (delimiters + key folding)
Highlights
Complete TOON spec v1.5 coverage: 146/146 fixtures passing (up from 111 in v0.1.1). Two major new options for LLM token efficiency: custom delimiters and key folding.
New features
Custom delimiters (saves tokens when values contain commas)
etoon.dumps([{"id": 1, "note": "Hello, world"}, {"id": 2, "note": "Foo, bar"}], delimiter="|")
# [2|]{id|note}:
# 1|Hello, world
# 2|Foo, barSupports , (default), \t, |. When the value delimiter is not comma, commas inside strings don't need quoting → fewer tokens.
Key folding (collapse nested chains)
etoon.dumps({"api": {"v2": {"users": {"count": 42}}}}, fold_keys=True)
# api.v2.users.count: 42Single-key object chains collapse into dot-notation. Saves 30-50% on deeply nested config/schema data. Options:
fold_keys=Trueenables safe-mode folding (skips segments needing quotes, avoids collisions with sibling literal keys)flatten_depth=Nlimits max chain length
Stricter key quoting
Keys now enforce the TOON identifier pattern [a-zA-Z_][a-zA-Z0-9_.]*. Keys with hyphens, symbols, or leading digits are now properly quoted ("full-name", "order:id").
Performance
| Encoder | Time (neptune 50-doc) | vs etoon |
|---|---|---|
| etoon v0.1.2 (Python) | ~15 μs | baseline |
| @toon-format/toon (TS SDK) | 35.6 μs | 2.4× slower |
| py-rtoon | 85.9 μs | 5.7× slower |
| toons | 106.4 μs | 7.1× slower |
~2μs regression vs v0.1.1 due to new param threading cost (Config struct, allow_fold). See v0.1.3 for the const-generic optimization that partially recovers it.
Install
pip install --upgrade etoon # Python
cargo add etoon --no-default-features # Rust library
cargo install etoon --no-default-features # Rust CLI from sourceFull Changelog: v0.1.1...v0.1.2