Function ruma_signatures::canonical_json[][src]

pub fn canonical_json(object: &CanonicalJsonObject) -> String
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);

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