macro_rules! json_response { ($($json:tt)+) => { ... }; }
Creates a JSON response directly from a JSON literal. Returns Ok(HttpResponse) for use as Response type.
json_response!({ "users": [{"id": 1, "name": "John"}] }) // With status code (chain on the Result) json_response!({"error": "Not found"}).map(|r| r.status(404))