Wanderlust type error 'undefined' on json object .response property

working on the Wanderlust project, on step 16/17 I keep getting a type error when logging the variable ‘venues’ to the console. I’ve narrowed it down to the object property jsonResponse.response being undefined but can’t figure out why. I’ve compared my code to all the hints and everything before this step works (jsonResponse logs to the console fine and I can see the properties, including ‘response’).

Here is my code in case I’m missing something. The line ‘console.log(jsonResponse.response);’ is not necessary to the lesson but used to narrow down the error.

const getVenues = async () => {
  const city = $input.val();
  const urlToFetch = `${url}${city}&limit=10&client_id=${clientId}&client_secret=${clientSecret}&v=20190726`;
  try {
    const response = await fetch(urlToFetch);
    if (response.ok) {
      const jsonResponse = response.json();
      const venues = jsonResponse.response.groups[0].items;
  } catch(error) {

Check out the line of code I referenced in my comment above, and re-read instruction #15. You are missing something. :wink:

ahhh, got it now, thanks!

1 Like