what's this in chrome console " Uncaught SyntaxError: Unexpected token ':' "
here is json file in root of application:
<script src="levels.json"></script> and this is my json file content :
{ "levels": [ [22, 22], [33, 25] ] } and my javascript code :
let data = JSON.parse(levels) console.log(data);
{...}is parsed as a code block, the quoted property name is just an expression, and finally the lonely colon causes the error.fetch('levels.json').then(r => r.json()).then(data => { /* do sth with data */ });, also stackoverflow.com/questions/14220321/…file:///...in your address bar? Then it won't work at all; you need a server. Or you change the file to levels.js and useconst data = { ... }, in that case any code further down can simply usedata