macro_rules! json {
{$( $key:ident : $val:expr ),* $(,)?} => { ... };
}
Expand description
Takes input similar to JavaScript object-notation and generates string of JSON.
let object = json_builder_macro::json! {
x: 78u32,
y: 72.4f64,
z: "thing"
};
assert_eq!(object, r#"{"x":78,"y":72.4,"z":"thing"}"#);