pub fn to_string<T: Serialize + ?Sized>(data: &T) -> Result<String, Error>
Returns an error if the input cannot be serialized as JavaScript-compatible JSON.