Skip to content

Commit b8848cd

Browse files
committed
Minify JSON
1 parent 527aa43 commit b8848cd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ fn main() -> Result<()> {
148148
Codec::Json => {
149149
let json = serde_json::from_slice::<serde_json::Value>(&buffer)
150150
.map_err(|e| anyhow!("Invalid input JSON: {}", e))?;
151-
(Some(json), buffer)
151+
let minified_buffer =
152+
serde_json::to_vec(&json).map_err(|e| anyhow!("Couldn't serialize JSON: {}", e))?;
153+
(Some(json), minified_buffer)
152154
}
153155
Codec::Raw => (None, buffer),
154156
Codec::JsonToMessagepack => {

0 commit comments

Comments
 (0)