I am using reqwest
to perform a GET
request from https://httpbin.org.
Performing a request to a one-level json endpoint like https://httpbin.org/ip is easy
use std::collections::HashMap;
fn main() {
let body = reqwest::blocking::get("https://httpbin.org/ip")
.unwrap()
.json::<HashMap<String, String>>()
.unwrap();
dbg!(body);
}
However Im not sure how to go about other endpoints with a multi-level JSON response. How can I make a request to a multi-level JSON endpoint in reqwest
?
use std::collections::HashMap;
fn main() {
let body = reqwest::blocking::get("https://httpbin.org/get")
.unwrap()
.json::<HashMap<K, V>>()
.unwrap();
dbg!(body);
}