pub fn extract_json_array(json_str: &str, path: &str) -> Result<Vec<Value>>Expand description
Extract a JSON array from a JSON string using a simple path expression.
Supports paths like $.field_name or $.field.nested.
Returns the array found at the given path.
Resilient to mixed-text input (e.g. LLM agent output with natural language before/after JSON). Tries in order:
- Parse the entire string as JSON
- Extract from a fenced code block (
json ...) - Scan for the first
{or[and try parsing from there