If you're just playing around, try JSON.parse() on a hardcoded string first to rule out JSON syntax errors.
For actual file loading, the File API is your friend. Here's a minimal example:
```html
<input type="file" id="jsonFile" accept=".json">
<script>
document.getElementById('jsonFile').addEventListener('change', function(e) {
const file = e.target.files[0];
const reader = new FileReader();
reader.onload = () => console.log(JSON.parse(reader.result));
reader.readAsText(file);
});
</script>
```
No server needed!
For actual file loading, the File API is your friend. Here's a minimal example:
```html
<input type="file" id="jsonFile" accept=".json">
<script>
document.getElementById('jsonFile').addEventListener('change', function(e) {
const file = e.target.files[0];
const reader = new FileReader();
reader.onload = () => console.log(JSON.parse(reader.result));
reader.readAsText(file);
});
</script>
```
No server needed!
