Skip to main content

extract_json_from_response

Function extract_json_from_response 

Source
pub fn extract_json_from_response(content: &str) -> String
Expand description

Extract JSON content from a response, handling markdown code fences.

CLI runners often wrap JSON in markdown fences (e.g. ```json ... ```). This function strips those fences and returns the raw JSON object using a brace-depth counter to find the outermost {...} block.