pub fn canonical_json(data: &Value) -> Result<String>
Expand description

Constructs the deterministic string representation of the provided JSON value.

The same JSON document can be represented in multiple ways depending on property ordering and string encoding. This canonical JSON format lists property names in ascending order by their utf8-encoded byte arrays and uses the NFKD normalized unicode representation of all strings (both property names and string values).

The function will return error if a provided JSON object has properties with the same name in different unicode normalizations. Note that creating Value arguments, serde_json accepts objects having properties with exactly the same name and keeps only the last value, ignoring all previous ones.