Skip to main content

json_val

Function json_val 

Source
pub fn json_val<T>(value: &T) -> Value
where T: Serialize,
Expand description

Convert a serializable value to serde_json::Value, falling back to Value::Null on error.

Replaces the boilerplate pattern:

serde_json::to_value(&x).unwrap_or_default()