I am trying to read a local JSON file using JavaScript. The file is in OneDrive however, and I am operating in Codepen. In the browser console, I get a 404 error.
fetch(".\Users\myName\OneDrive - myOrg\Documents\myFile.json")
.then(response => response.json())
.then(json => console.log(json));
Nothing is returning and I get that 404 error. I just want to console.log my json text. I can even convert it to a js file if that works better, but it didn't work here.
The file location actually reads: C:\Users\myName\OneDrive - myOrg\Documents\myFile.json , so am I writing the URL wrong? Is there a way to pull from OneDrive that I am missing? Is it because I am using Codepen? I can't figure it out.