Skip to main content

ensure_object

Function ensure_object 

Source
pub fn ensure_object<T: Serialize>(value: T, key: &str) -> Result<Value, Error>
Expand description

Ensures that a serialized value is always an object. If the value is a primitive type (string, number, bool, null, array), it wraps it in an object with a default key.