Skip to main content

json_path

Macro json_path 

Source
macro_rules! json_path {
    () => { ... };
    ( $($piece:expr),+ $(,)? ) => { ... };
}
Expand description

Creates a JSON path from path pieces, separated by commas

The arguments to this macro represent the path pieces:

Providing no arguments creates an empty path without any path pieces.

ยงExamples

let json_path = json_path!["outer", 3, "inner"];
assert_eq!(
    json_path,
    [
        ObjectMember("outer".to_owned()),
        ArrayItem(3),
        ObjectMember("inner".to_owned()),
    ]
);