JSON response in Get request in reqwest

Viewed 1436

Why reqwest return error while trying to .json() the response? Looks like im trying the same as in an example:

fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::blocking::get("https://pokeapi.co/api/v2/pokemon/1")?.json()?;
println!("{:?}", resp);
Ok(())
}

When i do text() instead of json() i get string as intended, but i can't seem to parse it to json. Thanks.

Error: Error: reqwest::Error { kind: Decode, source: Error("invalid type: map, expected unit", line: 1, column: 0) }

0 Answers
Related