Trait chewdata::helper::json_pointer::JsonPointer

source ·
pub trait JsonPointer {
    // Required method
    fn to_json_pointer(&self) -> String;
}

Required Methods§

source

fn to_json_pointer(&self) -> String

Retourn the json pointer

Implementations on Foreign Types§

source§

impl JsonPointer for String

source§

fn to_json_pointer(&self) -> String

Transform a path_field to a json_pointer (json_path). Escape . with \\ if the . is not separate two attribute names.

§Examples
use chewdata::helper::json_pointer::JsonPointer;

let field_path = "value.sub_value.0.array_value".to_string();
let expected_result = "/value/sub_value/0/array_value";
assert_eq!(expected_result, field_path.to_json_pointer());

let field_path = "value.sub_value[0].array_value".to_string();
assert_eq!(expected_result, field_path.to_json_pointer());

Implementors§