Terse JSON — compact binary JSON for microcontrollers
Project description
tson-bin — Terse JSON binary format for Python
TSON is a compact, schema-deduplicated binary format for JSON — field names are stored once, repeated strings are interned, giving 60–70% size reduction on repetitive data (API payloads, telemetry, config). These are the Python bindings (a native extension built in Rust via PyO3).
The PyPI distribution is
tson-binbut it imports astson.
Install
pip install tson-bin
import tson
Usage
import tson
# Compile a JSON string to TSON binary, and back
blob = tson.dumps('{"name": "Alice", "age": 30}') # -> bytes
obj = tson.loads(blob) # -> {"name": "Alice", "age": 30}
# Encode a Python object directly (no JSON string in between)
blob = tson.emit({"temp": 22.5, "status": "nominal"})
# File I/O
tson.dump('{"msg": "hello"}', "message.tson")
obj = tson.load("message.tson")
API
| Function | Signature | Description |
|---|---|---|
dumps(json_text) |
str -> bytes |
Compile a JSON string to TSON binary |
loads(blob) |
bytes -> object |
Decode TSON binary to a Python object |
dump(json_text, path) |
(str, str) -> None |
Compile a JSON string to a .tson file |
load(path) |
str -> object |
Read and decode a .tson file |
emit(obj) |
object -> bytes |
Encode a Python object directly to TSON |
Invalid input raises ValueError.
Documentation
License
MIT © SIKTEC Lab
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tson_bin-0.1.2-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: tson_bin-0.1.2-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 172.6 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
636b7a8e972d88a26404607fac9aa889f46a5f5a30dd1e92847194413334a041
|
|
| MD5 |
b270604557eb6b9c47965f5fe1193d61
|
|
| BLAKE2b-256 |
a6f609e33d85518289dc3753d1d184a8d521ea9f145e77ca27901a98e8b4a3be
|
Provenance
The following attestation bundles were made for tson_bin-0.1.2-cp312-cp312-win_amd64.whl:
Publisher:
release.yml on siktec-lab/tson
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tson_bin-0.1.2-cp312-cp312-win_amd64.whl -
Subject digest:
636b7a8e972d88a26404607fac9aa889f46a5f5a30dd1e92847194413334a041 - Sigstore transparency entry: 1906885731
- Sigstore integration time:
-
Permalink:
siktec-lab/tson@987c62c516bd3682c7d7a4b5768b9c13a4c3caa0 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/siktec-lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@987c62c516bd3682c7d7a4b5768b9c13a4c3caa0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tson_bin-0.1.2-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: tson_bin-0.1.2-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 260.3 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e953a387d27b2b9bd177a2d3ece4a2d67bbd0123752f4ad665f78bb9beb2d569
|
|
| MD5 |
17722a95c22a522fd6edc96cf20a9fe6
|
|
| BLAKE2b-256 |
a01d6c391b44246126560b1ce830c44753fc7a00ebbc69bc733d70c24b34e43f
|
Provenance
The following attestation bundles were made for tson_bin-0.1.2-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
release.yml on siktec-lab/tson
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tson_bin-0.1.2-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
e953a387d27b2b9bd177a2d3ece4a2d67bbd0123752f4ad665f78bb9beb2d569 - Sigstore transparency entry: 1906885640
- Sigstore integration time:
-
Permalink:
siktec-lab/tson@987c62c516bd3682c7d7a4b5768b9c13a4c3caa0 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/siktec-lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@987c62c516bd3682c7d7a4b5768b9c13a4c3caa0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tson_bin-0.1.2-cp312-cp312-macosx_10_12_x86_64.whl.
File metadata
- Download URL: tson_bin-0.1.2-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 279.1 kB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b6f0fd66f4dc633a8fc7a076a68cf7ec2bdb35e3176e01e2f00de089fbcd462
|
|
| MD5 |
0e0a8d7a298068da7c9aaa634bd0a336
|
|
| BLAKE2b-256 |
098c91965c9013eea397b071fca36e38f122815e635d023eb13b5a5ccdbf99a3
|
Provenance
The following attestation bundles were made for tson_bin-0.1.2-cp312-cp312-macosx_10_12_x86_64.whl:
Publisher:
release.yml on siktec-lab/tson
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tson_bin-0.1.2-cp312-cp312-macosx_10_12_x86_64.whl -
Subject digest:
2b6f0fd66f4dc633a8fc7a076a68cf7ec2bdb35e3176e01e2f00de089fbcd462 - Sigstore transparency entry: 1906885540
- Sigstore integration time:
-
Permalink:
siktec-lab/tson@987c62c516bd3682c7d7a4b5768b9c13a4c3caa0 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/siktec-lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@987c62c516bd3682c7d7a4b5768b9c13a4c3caa0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tson_bin-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: tson_bin-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 293.1 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e6eadade43f079fac0c2089878317bc1d011fdf4c54b436ed48c570f501e1f5
|
|
| MD5 |
957399a70e16481f598082288aa8db4f
|
|
| BLAKE2b-256 |
0bc3c210826f97dbe7692c8799ed079efc24d86d1075893f1c0d047556703603
|
Provenance
The following attestation bundles were made for tson_bin-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on siktec-lab/tson
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tson_bin-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
5e6eadade43f079fac0c2089878317bc1d011fdf4c54b436ed48c570f501e1f5 - Sigstore transparency entry: 1906885796
- Sigstore integration time:
-
Permalink:
siktec-lab/tson@987c62c516bd3682c7d7a4b5768b9c13a4c3caa0 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/siktec-lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@987c62c516bd3682c7d7a4b5768b9c13a4c3caa0 -
Trigger Event:
push
-
Statement type: