pub fn format_compact<T: Serialize>(data: &T) -> Result<String>Expand description
Format data as compact JSON (no formatting).
§Errors
Returns an error if JSON serialization fails (e.g., if the data contains non-serializable types or custom serialization fails).
§Examples
use serde::Serialize;
use mcp_execution_cli::formatters::json;
#[derive(Serialize)]
struct Data { value: i32 }
let data = Data { value: 42 };
let json = json::format_compact(&data).unwrap();
assert!(!json.contains('\n'));