pub fn format<T: Serialize>(data: &T) -> Result<String>
Format data as JSON.
Uses pretty-printing with 2-space indentation.