Extracts and parses JSON from LLM responses.
Summary
Functions
Extracts the longest JSON object string from content.
Extracts ALL valid JSON object strings found in content.
Extracts the first JSON array [...] from content.
Extracts the longest (outermost) valid JSON object from content.
Functions
Extracts the longest JSON object string from content.
Tries markdown code blocks first (json or), then falls back to
finding the outermost valid JSON object via balanced brace matching.
Returns "" if no JSON is found.
Extracts ALL valid JSON object strings found in content.
Returns a list of raw JSON strings, from left to right, or an empty list if none are found.
Extracts the first JSON array [...] from content.
Tries markdown code blocks first, then falls back to balanced bracket
matching. Returns the raw JSON string or "" if none found.
Extracts the longest (outermost) valid JSON object from content.