pub fn format<T: Serialize>(data: &T) -> Result<String>Expand description
Format data as JSON.
Uses pretty-printing with 2-space indentation.
ยงErrors
Returns an error if JSON serialization fails (e.g., if the data contains non-serializable types or custom serialization fails).