Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

107
Views
Parsed JSON data appearing as undefined in the console?

I used the fetch api to take the json data from the api that I linked in the code. I then tried to parse the data and log the quote from the parsed data in the console.

fetch("https://api.breakingbadquotes.xyz/v1/quotes")
.then(data => data.json())
.then(data => {
    console.log(JSON.parse(data.quote));
});

This came up with the error "unexpected token o in JSON at position 1" in the console, meaning that the data is already parsed. So, logically, I removed the JSON.parse method from line 4 expecting the issue to be resolved.

fetch("https://api.breakingbadquotes.xyz/v1/quotes")
.then(data => data.json())
.then(data => {
    console.log(data.quote);
});

However, this simply appeared as undefined in the console, meaning that data has not been parsed. Can anyone explain what the issue here is exactly? I apologize in advance if I am missing something obvious, I am still a beginner to javascript and programming as a whole. Thank you!

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!