Macro struson::json_path

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

Creates a JSONPath from path pieces

The arguments to this macro represent the path pieces:

At least one path piece argument must be provided.

Examples

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