use serde::Deserialize; use reqwest; #[derive(Deserialize, Debug)] struct Todo { #[serde(rename = "userId")] user_id: i32, id: i32, title: String, completed: bool, } #[tokio::main] async fn main() -> Result<(), reqwest::Error> { let todo: Todo = reqwest::get("https://jsonplaceholder.typicode.com/todos/1") .await? .json() .await?; println!("{:?}", todo); Ok(()) }