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

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.2.tar.gz (23.1 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.2-cp313-cp313-win_amd64.whl (260.0 kB view details)

Uploaded CPython 3.13Windows x86-64

etoon-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (358.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

etoon-0.1.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (330.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

etoon-0.1.2-cp313-cp313-macosx_11_0_arm64.whl (308.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

etoon-0.1.2-cp313-cp313-macosx_10_12_x86_64.whl (328.9 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

etoon-0.1.2-cp312-cp312-win_amd64.whl (260.0 kB view details)

Uploaded CPython 3.12Windows x86-64

etoon-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (358.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

etoon-0.1.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (331.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

etoon-0.1.2-cp312-cp312-macosx_11_0_arm64.whl (308.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

etoon-0.1.2-cp312-cp312-macosx_10_12_x86_64.whl (329.0 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

etoon-0.1.2-cp311-cp311-win_amd64.whl (261.9 kB view details)

Uploaded CPython 3.11Windows x86-64

etoon-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (358.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

etoon-0.1.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (331.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

etoon-0.1.2-cp311-cp311-macosx_11_0_arm64.whl (309.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

etoon-0.1.2-cp311-cp311-macosx_10_12_x86_64.whl (329.7 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

etoon-0.1.2-cp310-cp310-win_amd64.whl (261.8 kB view details)

Uploaded CPython 3.10Windows x86-64

etoon-0.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (358.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

etoon-0.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (331.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

etoon-0.1.2-cp310-cp310-macosx_11_0_arm64.whl (309.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

etoon-0.1.2-cp310-cp310-macosx_10_12_x86_64.whl (329.7 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: etoon-0.1.2.tar.gz
  • Upload date:
  • Size: 23.1 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.2.tar.gz
Algorithm Hash digest
SHA256 8c665d5ce52df6d33f62ec51747d44d948e503114e8067aff7e6426867bb8fc5
MD5 e60dc0bacb80b396e748a4c5e70c1092
BLAKE2b-256 a22926332884496c7931be9b1e0eb08c417e3329cd93ad05a6e39689ea137295

See more details on using hashes here.

File details

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

File metadata

  • Download URL: etoon-0.1.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 260.0 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.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6fd5cd8e2f19f30d0ce19a074e5aadbdf19addfbb7086a9e61bc786fb771a388
MD5 2ceed6bbc8163afd10b86f1767ff5420
BLAKE2b-256 219ef855c411cd87424088aea96a3462e8d59f90eae323da3614edde37a3e5c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for etoon-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ab718314bbdd9f401444daf51f8f976d0641e6819ec853deaf4a84f85f6ff2cc
MD5 ffec12542b0e2662017bcca407fe6abd
BLAKE2b-256 40668e3c59ec201971aefc63a492e2f13410671fff4de22c20e15ec28e0672ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for etoon-0.1.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dc3f1d370b7cabfe65a18a13f9f54385a74a9b54fac646eeb5ff401b4d6f2088
MD5 fe29cad7113f76d29c86cb6fd662301d
BLAKE2b-256 8fdfc1ec5db157b40b91da23aa7022260f3a275cae3a2ebcad2be470905df1f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for etoon-0.1.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eff4b75f1feed249a048e94f579f1797a364ba0a7d9ed502b67ac77dea8947e8
MD5 e600febf86c0ec4ef92c30ff9556417f
BLAKE2b-256 2157f9292be848ebe121c29615950f1069c4d04fd3f52225c6841d3da027f7da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for etoon-0.1.2-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 34ab4cc79e2c81cde7fa92471774b569791d453f4f09fc5e417b809d8da9047c
MD5 d39da9b295e5e7d8e3b5c804dd4a07fe
BLAKE2b-256 4fc350f846edab09d967830d6118f2ef0c0ff04fa808c51078f584e1efdf4a6c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: etoon-0.1.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 260.0 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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6aa44ed4a1fe30235013bbb9cdcf41705a2612235074ffd163d125f6b359de1e
MD5 6a3b389ae2921ba5d6f335abe168d71a
BLAKE2b-256 51251b9706ed44887834757530de34e5893720ecf3172c9a1d78e51b9e0138f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for etoon-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b2f3f7b01f61bb0ff8e207967872e3e8e94100cfbfff12156a0d5866d73c232f
MD5 bc07ae617f17d6870adf9df0e5c018d9
BLAKE2b-256 d26db2a514f1fabe7837d705d31e0a9bcd04bd7a509db1a039c4c074471c7c9c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for etoon-0.1.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 755820339092254f8c18ffcb39770710bb86e965c70dbea0d383465ca12465a1
MD5 7c81bd04dbf8b28c158605f8e874122d
BLAKE2b-256 0eeef9d2825c44f244a44204fc4bb5539a126a266b2fa91fba0c3fb3276dbb92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for etoon-0.1.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 68c4a7f6517a80ff4ebcf554c70785837eb9cdc623cb8c49dd308c16cba041bc
MD5 60e4603c933880d25bf270b924d3e9f9
BLAKE2b-256 b7bb2a63ab4cafb5a876e5cbe97c8c8bc81393691abb8c4a7a2acdfc916eaafc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for etoon-0.1.2-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8ab72724293a9a566638f1e281ae4db94590111fcbfed7b865d3ca031a9288a3
MD5 81ce86614f92230ca344b4bd801d82f6
BLAKE2b-256 ac99b658896791ff8abc14b91777caac8cc4838a482cd8a6c4f09c1ff9b4a89e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: etoon-0.1.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 261.9 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.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a498fe52fbd14ae35ec0ce0cec2d361b504b4d7efe4227ba4a6fdcaf9653c432
MD5 17942d862a895d2b59f024796ad4dad2
BLAKE2b-256 e1d6ed628ccbd931dedb594cf68c8c0eb2a5b121cd21777f2dac6c3ba576a7b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for etoon-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7fa85073f81d1c898b1d8e0c5026aaa02805e064216e9c3a8b23f4265446511e
MD5 3d18ae306c8dc1f7190f2533ef040fcd
BLAKE2b-256 6d20de83d6ec987072f40154c7a3a609bfe5974ddb0c06508fc8d074335b058b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for etoon-0.1.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 625284c86ceb6e15ac23ba431b38592b61b7b55c240de759cf86a377a1e13e3c
MD5 57ef59cb2cdc00a4ff4123014a08957d
BLAKE2b-256 08b095e3e22f0097d250747799b28591ae47420ef6662413c81059cc59c9e97f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for etoon-0.1.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 118f3bf9c24136eefa85cddcc8e4bfe0b6941a7a24f8b02615af9f9f2a28b5b6
MD5 99a733c618b0396f71cd226567b5dcd2
BLAKE2b-256 ec52ca8b659f9bcd4d2d4ceaf3855157d2e58d7a281dd195756466965762846f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for etoon-0.1.2-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7acc12b1cac9ecae92c71ad677df69316b50ebf60fb6e41bf4b7af25124fb2ec
MD5 746c7d0ddeb1d79c10853327161c84e5
BLAKE2b-256 557f3272ec6f1a942bc704ab1869fdb827bf4c31045d80a0776df52941d241e4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: etoon-0.1.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 261.8 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.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fb9bc852d7972f48d5f0f1d09c5573551245838023e068f5b4e160532db5ec8f
MD5 4022bd6834d0b53030a802e2cd6f646a
BLAKE2b-256 17512ad9f97a75bc2f02bc5cc1b4b482b61b96a2b5634c478a89946bd1ce1828

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for etoon-0.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c32a8b12abb040046b51cabd51459912890dac1d2fc38b75c2fb9ca8a9351a29
MD5 8374d481a32f9b82872ab038b1aa53da
BLAKE2b-256 a9a1129742ce122b775d5efb710c8b44e3c3e45d92f81ecc4aa22bb9bef89fa5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for etoon-0.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4935fe3d17e291b8511244ea6fc7f800a038e3ec29e16ee7fdfee0d79514d2df
MD5 daf316ec6fd095e14eb50f7310233a92
BLAKE2b-256 037e644c09cdc5a34ca3cf0f3b5ace62cb93e8192b24b7373ab4f5620709164a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for etoon-0.1.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f86f546d18128080fa971906e8f93919e2a2267e798cf25d478be76d7b31443c
MD5 9df3f8f2ea14aa4c60669fd8987d9751
BLAKE2b-256 b16c304f4daf4ec431acc8b4f5115a6a68de3c48c4cab7608b4c29238eddb759

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for etoon-0.1.2-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8a0c026da776c68306869d86caee50a1802bd0be380d7c1584e7b5febf7e447b
MD5 96e2c0098c50fb028bf5f240af9e004d
BLAKE2b-256 ebe43f5f2ffa81fa110060c9198256d4684729d64a14a2773f57882c7ef1e742

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