| Crates.io | jsot |
| lib.rs | jsot |
| version | 0.2.0 |
| created_at | 2025-06-26 06:51:12.566225+00 |
| updated_at | 2025-06-26 07:10:54.244948+00 |
| description | A tiny helper for shipping generic data in a short string. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1726894 |
| size | 23,241 |
A tiny helper for shipping generic data in a short string.
The crate lets you encode any serde_json::Value into a compact text payload and decode it back.
The string is prefixed with a Transport ID to allow for future compression alternatives.
Add to Cargo.toml:
[dependencies]
jsot = "0.1"
serde_json = "1"
use jsot::encode;
use serde_json::json;
let value = json!({ "hello": "world" });
let blob = encode(value)?;
assert_eq!("2eyJoZWxsbyI6IndvcmxkIn0=", blob);
use jsot::decode;
let blob = "2eyJoZWxsbyI6IndvcmxkIn0=";
let value = decode(blob.as_bytes())?;
assert_eq!(json!({ "hello": "world" }), value);
The data format consists of a transport ID byte, followed by Base64 data.
| Transport ID | Compression | Wrapper |
|---|---|---|
'1' |
Zstd | Base64 |
'2' |
None | Base64 |
All other IDs are reserved for future considerations.
JSON data is encoded as JSON -> Compression (e.g. Zstd) -> Base64.
Dual-licensed under MIT OR Apache-2.0.