Skip to main content

resolve_owned

Function resolve_owned 

Source
pub fn resolve_owned(value: &Value, path: &str) -> Result<Value, FaceError>
Expand description

Resolve and clone the result, useful when the caller needs an owned Value (e.g. to feed it across an API boundary).

§Errors

See resolve.

§Examples

use face_core::path;
use serde_json::json;

let v = json!({"hits": [10, 20, 30]});
let owned = path::resolve_owned(&v, ".hits[1]").unwrap();
assert_eq!(owned, json!(20));