COMPACTO
(work in progress)
A fast way to minify JSON.
Usage/Examples
# Compress
# Input example (~0.11 KB)
# {
# "id": "123",
# "name": "Eduardo",
# "doc": {
# "id": "222",
# "fullname": "Eduardo"
# }
# }
compacto input-file.json compressed.json -c
# Decompress
# Output example (~0.09 KB)
# [
# {
# "0":{
# "1":2,
# "3":4
# },
# "3":5,
# "6":2
# },
# [
# "doc",
# "fullname",
# "Eduardo",
# "id",
# "222",
# "123",
# "name"
# ]
# ]
compacto compressed.json decompressed.json -d
Compress
use serde_json::Value;
use compacto::compress::Compress;
// Compress values
let json: Value = serde_json::from_str(r#"{"id": "123", "123": "id"}"#)?;
let result : Value = Compress::new(json).run();
println("{:#?}", result); // [{"0":1,"1":0},["123","id"]]
Decompress
use serde_json::Value;
use compacto::compress::Decompress;
let json: Value = serde_json::from_str(r#"[{"0":1,"1":0},["123","id"]]"#)?;
let result : Value = Decompress::new(json).run();
println("{:#?}", result); // {"123":"id","id":"123"}