Function insert_key

Source
pub fn insert_key<T: Serialize>(input: T, key: &str, value: Value) -> Value
Expand description

Inserts a key-value pair into a JSON object. If the input is an object, it adds the key directly. If not, it wraps the input in a new object under “original” and adds the new key. Returns the modified Value.