Skip to main content

extract_json_from_response

Function extract_json_from_response 

Source
pub fn extract_json_from_response<T: DeserializeOwned>(raw: &str) -> Option<T>
Expand description

Extract a JSON object from an LLM response string.

LLMs sometimes wrap JSON in markdown fences or explanatory text. This tries direct parse first, then finds the outermost {...}.