Basic HTML: How to Read JSON of Data – Where Do I Start? or Struggling with Basic HTML – How to Read

18 Replies, 462 Views

If you’re struggling with basic html how to read json of data, try this:

1. Make sure your JSON file is in the same folder as your HTML.
2. Use `<script src="yourfile.js"></script>` to link your JS.
3. In the JS file, fetch the JSON and loop through it to display stuff.

Example:
```javascript
fetch('data.json')
.then(res => res.json())
.then(data => {
document.body.innerHTML = JSON.stringify(data);
});
```

It’s crude, but it’ll show you the data!

Messages In This Thread



Users browsing this thread: 1 Guest(s)