Load JSON File, unexpected token /

Hello everyone, i need your help.

I try to load json file from cocos, I try this code

cc.loader.loadJson("asset/GamePlay.json", function(err, json){
            cc.log("loading json file..");
            cc.log(json);
            console.dir(json);
        
        }); 

But it give me an error

Uncaught parse json [asset/GamePlay.json] failed : SyntaxError: Unexpected token /

The resource path is right, whats the problem?

Thank you…

Do you have comments in GamePlay.json ?
they are not in json specifications but some parse/browser support them… or not.

1 Like

Yes, you are right. Thank you :smile: