I am trying to have my application turn a json file into an object, which also has functions in it, but I don't know how to do this. This is my json file that won't work:
{
"draw": function() {
ctx.clearRect(0,0,960,720);
ctx.fillStyle = "#000000";
},
"load": function() {
if (beginning = 0) { erasePrev };
loadHTML('button','level1Button',"position:absolute; top:100px; left:200px;",'LEVEL I','loadLevel(1)',false,false);
loadHTML('a','howtoplayhref',"position:absolute; top:100px; left:100px;",'how to play',false,false,'howtoplay.html');
},
"clear": function() {
removeHTML(level1Button);
removeHTML(howtoplayhref);
}
}
I know how to load and parse the file, the problem is that it won't pass a json validator.