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