Trait jsonpath_rust::JsonPathQuery[][src]

pub trait JsonPathQuery {
    fn path(self, query: &str) -> Result<Value, String>;
}
Expand description

the trait allows to mix the method path to the value of Value and thus the using can be shortened to the following one:

Examples:

use serde_json::{json,Value};
use jsonpath_rust::JsonPathQuery;
fn test(){
        let json: Value = serde_json::from_str("{}").expect("to get json");
        let v = json.path("$..book[?(@.author size 10)].title").expect("the path is correct");
        assert_eq!(v, json!([]));
}

#Note: the result is going to be cloned and therefore it can be significant for the huge queries

Required methods

Implementations on Foreign Types

Implementors