bmel:json-path¶
Category: JSON · Returns: bmel:any
Signature
bmel:json-path(json: bmel:any, path: bmel:string)
Description¶
Extracts a value from a JSON string or object using a JSONPath expression. Useful when a frame source field carries an embedded JSON string (e.g. a metadata or arguments field returned as a serialized string by an LLM) and you need to reach into it without a dedicated mapping. Supports the standard JSONPath subset: dot notation ($.a.b), bracket notation ($['a']['b']), array index ($[0]), recursive descent ($..), wildcard (*), and filter expressions (?(@.price < 10)). Returns null when the path does not match. Returns an array when the path matches multiple nodes.
Arguments¶
| Parameter | Type | Required | Description |
|---|---|---|---|
json | bmel:any | The JSON string or object to query. If a string is provided it is parsed first; if parsing fails, null is returned. | |
path | bmel:string | JSONPath expression starting with $. (e.g. $.choices[0].message.content, $.usage.total_tokens). |
Examples¶
A value inside a JSON string
bmel:json-path({invokeAgent:Response Payload}.$.tool_arguments, '$.city')
The first item of an embedded list
bmel:json-path({invokeAgent:Response Payload}.$.metadata_json, '$.items[0].sku')