Skip to main content

parse_json

Function parse_json 

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

Extract and deserialize a JSON value from an LLM text response, tolerating Markdown code fences.

Returns None if content is empty or the payload is not valid JSON for the target type — same fail-soft contract as the Python original, but the success type is whatever you ask for.