[b]"How can I use JavaScript to load a JSON file from my desktop?"[/b] Alternatively, for a more direct approach:

16 Replies, 568 Views

"Best way to load a JSON file from desktop using JavaScript?"

Hey folks!

I'm trying to use javascript load json file from desktop for a small project, but I'm stuck. What's the easiest way to do this?

I tried `fetch()` but it’s not working—probably because of file permissions or something?

Any tips or code snippets would be awesome. Thanks in advance!

---

*Or the troubleshooting version:*

"Why isn't my javascript load json file from desktop working?"

So I’ve got this JSON file on my desktop, and my code looks like:

```js
fetch('file.json').then(res => res.json())...
```

But it’s throwing errors. Am I missing something obvious?

Is there a better way to do this? Help a noob out! 😅

Messages In This Thread
[b]"How can I use JavaScript to load a JSON file from my desktop?"[/b] Alternatively, for a more direct approach: - by - 26-09-2024, 10:25 AM



Users browsing this thread: 1 Guest(s)