pub fn canonical_json(object: &CanonicalJsonObject) -> Result<String, Error>
Expand description

Converts an event into the canonical string form.

§Parameters

  • object: The JSON object to convert.

§Examples

let input = r#"{
    "本": 2,
    "日": 1
}"#;

let object = serde_json::from_str(input).unwrap();
let canonical = ruma_signatures::canonical_json(&object).unwrap();

assert_eq!(canonical, r#"{"日":1,"本":2}"#);