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:
- numbers of type
u32are converted toJsonPathPiece::ArrayItem - strings are converted to
JsonPathPiece::ObjectMember
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()),
]
);