Skip to main content

Module json_extract

Module json_extract 

Source
Expand description

Extraction of balanced JSON blocks embedded in free-form text.

LLM responses and tool output frequently wrap a JSON payload in prose or code fences. first_json_block returns the first balanced {...} or [...] block, honoring string literals and rejecting mismatched nesting, so callers can hand the slice to serde_json.

Functionsยง

first_json_block
Return the first balanced JSON object or array embedded in text.