__json_optional

Macro __json_optional 

Source
macro_rules! __json_optional {
    ($inner:expr) => { ... };
}
Expand description

Matches a JSON field that may be missing or null, or matches the given inner matcher.

Example:

let value = json!({ "id": 42 });
assert_that!(
    value,
    json::pat!({
        "id": eq(42),
        "nickname": json::optional!(eq("Bob"))
    })
);