pub fn to_value<T: Serialize>(value: T) -> Result<Value, Error>
Serialize a value to a JSON Value.
Returns an error if serialization fails.