loading...

re: How can I read a local JSON file in HTML/JavaScript? VIEW POST

FULL DISCUSSION
 

Using fetch locally will do to, just pass the file location of the json file and it will work exactly as if you're fetching from an actual api .
async function getData(){
const data = await fetch('data.json'); // assuming that the json file is in the same folder
}// then you can just process it like a normal fetch request

 

TYSM! I appreciate this, and surprisingly it is the method Rishi Kumar Chawda showed (w/o the promises), and as I just asked them, to make this easier, is there a way to let the data break (escape) the scope of the promise?
Thanks!
Cheers!

code of conduct - report abuse