canonicalize_json

Function canonicalize_json 

Source
pub fn canonicalize_json(value: &Value) -> Result<String>
Expand description

Canonicalize JSON for deterministic hashing.

Uses serde_json with preserve_order feature to ensure consistent key ordering across serialization calls. This is critical for generating stable checksums of template contexts.

§Arguments

  • value - The JSON value to canonicalize

§Returns

A deterministic string representation of the JSON value

§Errors

Returns an error if the JSON value cannot be serialized (should be rare for valid serde_json::Value instances).