json-canon 0.1.3

Serialize JSON into a canonical format.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use json_canon::to_string;
use serde_json::{json, Error};

fn main() -> Result<(), Error> {
    let data = json!({
        "from_account": "543 232 625-3",
        "to_account": "321 567 636-4",
        "amount": 500,
        "currency": "USD"
    });

    println!("{}", to_string(&data)?);
    // {"amount":500,"currency":"USD","from_account":"543 232 625-3","to_account":"321 567 636-4"}

    Ok(())
}