Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

71
Views
Trouble importing json file to .js file

I have a simple javascript file that's meant to fetch an object as a json file and display it in the console:

javascript code

When I run the page on my app, I get these error messages:

errors

As far as I can tell, my directories are set up fine and I don't think there are any typos in the code. I think the problem has something to do with not being able to find the json file. I've even tried putting the json file in the same folder as main.js but this hasn't worked either. This is how my directory is laid out anyway in case the error has something to do with that:

Directories

I'm making an app using Flask and ultimately want to be able to store the json object in a js variable so I can use d3 to make tree graphs with it.

7 months ago ยท Juan Pablo Isaza
Answer question
Find remote jobs