I want to load a JSON file locally into my HTML page, without using a web server. This isn't possible with AJAX so I came up with this solution:
HTML:
<script src="../js/hack.js"></script>
<script src="../js/data.json"></script>
Inside hack.js :
var myJsonData =
And the json file looks like this:
[{"something":"anything"},{},{}]
I expected that the ultimate result would be this:
var myJsonData = [{"something":"anything"},{},{}]
But sadly I get the error: Uncaught SyntaxError: Unexpected end of input after loading 'hack.js'.
Is there any way to solve this without adjusting the json file, and without adjusting the local browser settings / using a localhost server?