Function jmespath_community::search

source ·
pub fn search(expression: &str, root: &Value) -> Result<Value, Error>
Expand description

Evaluates a JMESPath expression and returns a Value.

Example

use jmespath_community as jmespath;
use jmespath::search;
use jmespath::map;
use jmespath::Map;
use serde_json;

let input = map!("foo"=> "bar").into();
let expression = "'foo'";
let result = search(expression, &input).unwrap();

assert_eq!("\"foo\"", serde_json::to_string(&result).unwrap());