use json_syntax::JsonPrint;
#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
struct MyType {
foo: String,
bar: Vec<u32>,
}
fn main() {
let a = MyType {
foo: "Hello World!".to_string(),
bar: vec![1, 2, 3],
};
let json = json_syntax::to_value(&a).expect("serialization failed");
println!("{}", json.pretty_print());
let b: MyType = json_syntax::from_value(json).expect("deserialization failed");
assert_eq!(a, b)
}