-1

I'm trying to read JSON file into HTML, by using fetch. The problem is that when i open console in chrome it gives me an error. Here's the code. Any suggestions?

fetch('books.json')
  .then(response=>response.json())
  .then(data => {
    console.log(data);
  })

Here's the error

Phil
  • 141,914
  • 21
  • 225
  • 223
  • This can solve your problem: https://stackoverflow.com/questions/51859358/how-to-read-json-file-with-fetch-in-javascript – Elvis Pimentel May 19 '22 at 23:15
  • If you take the error message and search for it, you'll typically find answers pretty quickly. That's how I found the duplicate post – Phil May 19 '22 at 23:15

0 Answers0