Skip to content

Instantly share code, notes, and snippets.

@Licenser
Created February 18, 2019 19:51
Show Gist options
  • Save Licenser/b9e3c3f014563d91efd9a0e2616590d3 to your computer and use it in GitHub Desktop.
Save Licenser/b9e3c3f014563d91efd9a0e2616590d3 to your computer and use it in GitHub Desktop.
[package]
name = "j2m"
version = "0.1.0"
edition = "2018"
[dependencies]
base64 = "*"
serde = "*"
serde_json = "*"
rmp-serde = "*"
use base64;
use rmp_serde as rmps;
use serde::Serialize;
use serde_json;
use std::io::{self, BufRead};
fn main() {
let stdin = io::stdin();
for line in stdin.lock().lines() {
let line = line.unwrap();
let j: serde_json::Value = serde_json::from_str(&line).unwrap();
let m = rmps::to_vec(&j).unwrap();
println!("{}", base64::encode(&m));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment