Skip to main content

extract_context

Function extract_context 

Source
pub fn extract_context(
    record: &Value,
    mapping: &HashMap<String, String>,
) -> Result<HashMap<String, Value>, FaucetError>
Expand description

Extract context values from a record using JSONPath expressions.

Each entry in mapping is context_key -> json_path. The function queries the record with each JSONPath and stores the first matched value under the corresponding context key.

Returns an error if any JSONPath matches nothing.