jsot
A tiny helper for shipping generic data in a short string.
What is this?
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.
Quick start
Add to Cargo.toml
:
[]
= "0.1"
= "1"
Encoding
use encode;
use json;
let value = json!;
let blob = encode?;
assert_eq!;
Decoding
use decode;
let blob = "2eyJoZWxsbyI6IndvcmxkIn0=";
let value = decode?;
assert_eq!;
Format specification
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
.
License
Dual-licensed under MIT OR Apache-2.0.
Contributing
- Heads-up: this repository is published for reference only.
- We are not accepting pull requests, issues, or feature requests at this time.
Why is the code public?
- To document the wire / file format in a runnable, audited form.
- To make it easy for other teams to port the encoder/decoder to their own language or stack.