json_proc

Derive Macro ToJson

source
#[derive(ToJson)]
Expand description

Derive the ToJson trait for a struct.

Examples:

#[derive(ToJson)]
struct Example1 {
    field1: bool,
    field2: i8
}
 
fn print() {
    println!("{}", json!(Example1 {
        field1: true,
        field2: -2
    }))
}