Skip to main content

Fast TOON (Token-Oriented Object Notation) encoder. Byte-identical to the TOON spec, 8x faster than toons and 2.7x faster than the official TS SDK.

Project description

etoon

Fast TOON (Token-Oriented Object Notation) encoder for Python, Rust, and CLI.

8× faster than toons, 2.7× faster than the official TS SDK, byte-identical output.

中文說明

Performance

Measured on a 50-doc "neptune" payload (7480 bytes JSON → 4012 bytes TOON):

Encoder Time Relative
etoon (Python) 13.0 μs 1.00×
@toon-format/toon (TS) 35.6 μs 2.73×
py-rtoon 85.9 μs 6.59×
toons 106.4 μs 8.17×

CLI via stdin pipe (Claude / Bash workflows):

CLI Per call Relative
etoon 0.57 ms 1.00×
official toon 50.7 ms 89× slower

Install

Python

pip install etoon

Rust library

cargo add etoon --no-default-features

CLI binary

Download from GitHub Releases, or:

cargo install etoon

Usage

Python

import etoon
docs = [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]
print(etoon.dumps(docs))
# [2]{id,name}:
#   1,Alice
#   2,Bob

CLI (Bash pipe)

curl -s https://api.example.com/data | etoon
cat data.json | etoon -o output.toon

LLM agents (Claude Code, etc.)

Add | etoon to any JSON-emitting shell command to save LLM tokens when reading the output. The transformation is lossless and the TOON format is far more compact (40-60% fewer tokens typical).

gh pr list --json number,title,author | etoon
aws s3api list-buckets | etoon
kubectl get pods -o json | etoon

Pipeline rules for LLM use:

  • Terminal-only — jq / grep / awk must come before | etoon, never after
  • Non-JSON input passes through unchanged (safe to default-on)
  • Skip for byte-exact diff comparisons or tiny single-blob outputs
  • If etoon fails (rare, on malformed JSON), re-run without the pipe

Example Claude Code rule in CLAUDE.md:

Append | etoon to any JSON-emitting bash command by default. Place it at the very end of the pipeline. Re-run without pipe if it fails.

Rust

let json_bytes = serde_json::to_vec(&my_data)?;
let toon = etoon::toon::encode(&json_bytes)?;

Architecture

Python dict → orjson.dumps → JSON bytes → sonic-rs (SIMD parse) → walk → TOON string

Key optimizations:

  • sonic-rs SIMD JSON parser (~7× faster than serde_json)
  • orjson bridge — single boundary crossing (vs PyO3-based alternatives)
  • uniform-order table fast path — skips 300 key lookups per 50-row table
  • itoa specialized integer formatting

Compatibility

Output is byte-identical to the toons Python package (Apache 2.0) and the official toon-format/toon TypeScript SDK. Passes 111/111 TOON spec fixtures covering primitives, objects, arrays (primitive/tabular/nested/bulleted), and whitespace.

Advanced options

# Custom delimiter (saves tokens when values contain commas)
etoon.dumps(data, delimiter="|")   # or "\t"

# Key folding: collapse {a:{b:{c:1}}} → "a.b.c: 1"
etoon.dumps(data, fold_keys=True)
etoon.dumps(data, fold_keys=True, flatten_depth=2)  # partial fold

Limitations

  • Integers > 2⁶³ are lossily coerced via f64 (works for most common big integers that happen to be representable; arbitrary-precision is not supported).
  • Custom indent is hardcoded to 2 spaces (TOON spec default).

License

Apache 2.0. Test fixtures in tests/fixtures/ are sourced from the toons project (Apache 2.0).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

etoon-0.1.3.tar.gz (23.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

etoon-0.1.3-cp313-cp313-win_amd64.whl (267.9 kB view details)

Uploaded CPython 3.13Windows x86-64

etoon-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (365.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

etoon-0.1.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (336.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

etoon-0.1.3-cp313-cp313-macosx_11_0_arm64.whl (314.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

etoon-0.1.3-cp313-cp313-macosx_10_12_x86_64.whl (335.7 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

etoon-0.1.3-cp312-cp312-win_amd64.whl (267.9 kB view details)

Uploaded CPython 3.12Windows x86-64

etoon-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (365.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

etoon-0.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (337.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

etoon-0.1.3-cp312-cp312-macosx_11_0_arm64.whl (314.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

etoon-0.1.3-cp312-cp312-macosx_10_12_x86_64.whl (335.8 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

etoon-0.1.3-cp311-cp311-win_amd64.whl (269.6 kB view details)

Uploaded CPython 3.11Windows x86-64

etoon-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (366.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

etoon-0.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (337.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

etoon-0.1.3-cp311-cp311-macosx_11_0_arm64.whl (315.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

etoon-0.1.3-cp311-cp311-macosx_10_12_x86_64.whl (336.4 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

etoon-0.1.3-cp310-cp310-win_amd64.whl (269.5 kB view details)

Uploaded CPython 3.10Windows x86-64

etoon-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (366.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

etoon-0.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (337.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

etoon-0.1.3-cp310-cp310-macosx_11_0_arm64.whl (315.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

etoon-0.1.3-cp310-cp310-macosx_10_12_x86_64.whl (336.4 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

Details for the file etoon-0.1.3.tar.gz.

File metadata

  • Download URL: etoon-0.1.3.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for etoon-0.1.3.tar.gz
Algorithm Hash digest
SHA256 99c712a2048e5fb6ea8693ab14e3e5bd3d3246393c967696030e88243c241fb5
MD5 ccc73836ced42182d9e9a08e5939dc42
BLAKE2b-256 ef249a1b2ae76b3e771861dc90190ad3422ae17675d61491a2da72488cd1429f

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: etoon-0.1.3-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 267.9 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for etoon-0.1.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d6aab9fe1c7af18d1b27c232e6a92d116cd7a496f084171d097dc2637392ff7c
MD5 6ea4ee021870972239c68c3ecf69c6ac
BLAKE2b-256 1aebc9969c7a5c2b8f9b4bc49a9a2b7437e67c4030d62a0a1a23c1c659a49550

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for etoon-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6774b1b090704d55d6614828a292a311967894d456cbbb3c4f8434cbe6e86be1
MD5 9a18b3114d68c7cbae205ccfc4061e2e
BLAKE2b-256 51ab82613a69de9af3661ab4607faf3764c7be97ba5985007b624a89c7e1b51a

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for etoon-0.1.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2b2c186ea988fad9ec34249f622b460df3395bed24e5a7dc7cf08cf1a09cd014
MD5 91933cd5e58b49b3c23ac8ee8473c3b7
BLAKE2b-256 6df4c14753d839b0322a682a8da0e860ea9b0407be5fcaddb167fa3d4a3da8cf

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for etoon-0.1.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2216ddf464ad246b3afda7bdd53a846249948b3d854b19ea1e15a83143d5c67a
MD5 07a461f04e3757f5c4bdcabd0f7f9611
BLAKE2b-256 5b8e3301246aafa08e98710b5ae65969cdf3b47500e7468c3721a85de9a7177e

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for etoon-0.1.3-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c3b0410ccf644a37176e2e3f4f81f7d061660dd93d898b16df2992ef32bb8b6a
MD5 787a1673de85836d6258ae0f21af0fa2
BLAKE2b-256 6652811fc97d8d1497babc9a306c171559e12c3f0be641759ee83c9aa1d7362e

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: etoon-0.1.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 267.9 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for etoon-0.1.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 66fd444ded5e2ed59c8d820ca46b3d3293b3702ea6b2d47d11b4d5abfd184940
MD5 f507671653a4fc76e370f9b53a173e75
BLAKE2b-256 2bcc8477b3f3d8eae7eca03ca15e940358a8245f7b953577cc85e750cb112ac1

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for etoon-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ecc745366da9d53e30c51104f9ddad4d795d73e6b5631a47e0774e9abb225cfb
MD5 1e6e7b69eb8f0479e78f2e2f39ecd680
BLAKE2b-256 2b5c3b04a3174fb24efc31d4bfb1075920c212ec79245ab11fa484b381cb8900

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for etoon-0.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f6c03bf415160bef2b751b92924909897e2ed48b25ec350bed25d3a9b2aace6a
MD5 2e3bc19237a15b8d5df8ba5cab707206
BLAKE2b-256 5681fcda648edbb6721cbf6f016fe1b1b54d3f8a81ed625a6a56cded416fb6c4

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for etoon-0.1.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 79abedf999718a8b7ef87669dcdd1d3df51897c5f893df856242cf09f7a2f485
MD5 ad9492bc9a5faec8be4cb2f456b3011a
BLAKE2b-256 5240fb2612f1d3fe5baa445f28bf4dad6e479dbf33ce6f65a57502bd42a37aa0

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for etoon-0.1.3-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8c65705979c05dbba0d6f0ad12b6155593fdb4b7c7bdcee92b335b947a2e4c66
MD5 68c871410501447ff9147ea7b0d6a935
BLAKE2b-256 95729bc39c4980f83792f801d7d36240c50cf442b8ebba5c69f04b49e4c14b9c

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: etoon-0.1.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 269.6 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for etoon-0.1.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b04035faabe66cf7d96ba52d3451dff31ac62c272057a6c66c917914e6036e95
MD5 7d66d3e8cadcc3c741b2474240340a65
BLAKE2b-256 20975e4cbe4cd91854397a7a8d6f8a42dd2bddceb0fe2f5aff3ded47463875cb

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for etoon-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3ed0d1eb4f1d4302120173a1addafca15974212f4180eb21886d2e0e1a57ed99
MD5 7cdd48f5a19618184c4793d4def67c5c
BLAKE2b-256 25670cececb0063b257efc0ef61a70f7cd91c148df97b7406d3adc314fe061d0

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for etoon-0.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b68a85422590e952a688b8c3e6fb8a5f195e7de4e39aaadfbc79c55a54757a83
MD5 0fa8abb6a4420c09f8210289ef2063dd
BLAKE2b-256 6cf41c02ee2e8046d4ae3efba7a6018d01c3f27aa291d7699e84ca44fda278c9

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for etoon-0.1.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e149a45bdf33812768341716c4fde4e9c9ed49962e91ccda918518e12a8bc0ac
MD5 2d671258ea1a91147d5a379a3bf49235
BLAKE2b-256 c12d94dc1faa9c8f145d097c913b1643557bd100568eb76aa01ca5f080d4bbc0

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for etoon-0.1.3-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9e7b38b3f163aa7fad2e6f39e2e42301fd78193eb766826a4160eba4ebe79fab
MD5 428149053913b9d706ef852092c60b29
BLAKE2b-256 e4110f1d593e610502ab927145e0f70e7d261142f423bba637451ac0d828e8c7

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: etoon-0.1.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 269.5 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for etoon-0.1.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b83b329bc3f27e22259548e41b4b18f1583076f313262332f3372e6d2523529f
MD5 d2d1725fc0c00a638a79c8b02c3e9cc6
BLAKE2b-256 ca565275d7cdc9d90a4932fb85835065823d999071664aede4ce83936bf48d6b

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for etoon-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 acea56b848bb119f2ebc9c377391165ead83060ec419979fb4374d401c388581
MD5 cec2a38c8510364ffdb11d5ce7c8852f
BLAKE2b-256 c07a915d4bc952532c001104ad6b67e2c78e5f210c5fda701d34ce2cd39d98f6

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for etoon-0.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 003148fec0c2bed1fc2957dcc450999a54a9869e7c121da9e73eb5a7273d2cdb
MD5 46cceefe2016bf40aa7857807bce7ea8
BLAKE2b-256 6f4c9179f242db6273b6522201e93d6d558f04e632748f98bcb3b4caba1a5662

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for etoon-0.1.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1344e106bed497fc98a897141c6d1a9c60cad7403273b98c8caf617772f94685
MD5 508acbc8b250c6c03b5a93a7560ce3a9
BLAKE2b-256 0c8b1c57d9a973660786bf82f51f33be1df45ef3a0c9b2e3693685bd5dc76170

See more details on using hashes here.

File details

Details for the file etoon-0.1.3-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for etoon-0.1.3-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 75ecf082b726dcdb5d261710374bb6639049deace1002b5b82544240a97d9323
MD5 f6fcd2d68929a7efe33a3b73101e493b
BLAKE2b-256 a01f5bb06860f063b52781c59a90cb8eecb36245685b2e3c4b82832c9a153d92

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page