conjure_oxide::utils::json

Function sort_json_object

Source
pub fn sort_json_object(value: &Value, sort_arrays: bool) -> Value
Expand description

Recursively sorts the keys of all JSON objects within the provided JSON value.

serde_json will output JSON objects in an arbitrary key order. this is normally fine, except in our use case we wouldn’t want to update the expected output again and again. so a consistent (sorted) ordering of the keys is desirable.