Struct jsonpath_rust::JsonPathFinder
source · pub struct JsonPathFinder { /* private fields */ }
Expand description
The base structure stitching the json instance and jsonpath instance
Implementations§
source§impl JsonPathFinder
impl JsonPathFinder
sourcepub fn new(json: Box<Value>, path: Box<JsonPathInst>) -> Self
pub fn new(json: Box<Value>, path: Box<JsonPathInst>) -> Self
creates a new instance of JsonPathFinder
pub fn new_with_cfg( json: Box<Value>, path: Box<JsonPathInst>, cfg: JsonPathConfig ) -> Self
sourcepub fn set_cfg(&mut self, cfg: JsonPathConfig)
pub fn set_cfg(&mut self, cfg: JsonPathConfig)
sets a cfg with a new one
sourcepub fn set_path(&mut self, path: Box<JsonPathInst>)
pub fn set_path(&mut self, path: Box<JsonPathInst>)
updates a path with a new one
sourcepub fn set_json_str(&mut self, json: &str) -> Result<(), String>
pub fn set_json_str(&mut self, json: &str) -> Result<(), String>
updates a json from string and therefore can be some parsing errors
sourcepub fn set_path_str(&mut self, path: &str) -> Result<(), String>
pub fn set_path_str(&mut self, path: &str) -> Result<(), String>
updates a path from string and therefore can be some parsing errors
sourcepub fn from_str(json: &str, path: &str) -> Result<Self, String>
pub fn from_str(json: &str, path: &str) -> Result<Self, String>
create a new instance from string and therefore can be some parsing errors
pub fn from_str_with_cfg( json: &str, path: &str, cfg: JsonPathConfig ) -> Result<Self, String>
sourcepub fn instance(&self) -> PathInstance<'_>
pub fn instance(&self) -> PathInstance<'_>
creates an instance to find a json slice from the json
sourcepub fn find_slice(&self) -> Vec<JsonPathValue<'_, Value>>
pub fn find_slice(&self) -> Vec<JsonPathValue<'_, Value>>
finds a slice of data in the set json. The result is a vector of references to the incoming structure.
sourcepub fn find(&self) -> Value
pub fn find(&self) -> Value
finds a slice of data and wrap it with Value::Array by cloning the data. Returns either an array of elements or Json::Null if the match is incorrect.
sourcepub fn find_as_path(&self) -> Value
pub fn find_as_path(&self) -> Value
finds a path of the values. If the values has been obtained by moving the data out of the initial json the path is absent.