Jump to content

Help with JSON.parse error?


Nebulocity
 Share

Recommended Posts

I built the game from LessMilk's "Discover Phaser" eBook, and it went great. 

 

  • It runs fine using the Mongoose web server on my home PC
  • It runs fine IIS at work (lunchtime fun)
  • It runs fine hosted off of Google Drive
  • ...It fails to run when hosted on my site (through Arvixe.com).

 

Being extremely new to using JSON, I wanted to see if I could get some assistance from folks who had more experience with loading JSON files (through Phaser, as it's a Phaser error), before I contacted my host to find out if the error could be on their side (maybe they block JSON?).

 

When I try to run the game, I get the following two errors:

Error: http://literaryhodor.us/games/superyenman/phaser.min.js is being assigned a //# sourceMappingURL, but                already has one "Phaser v2.0.6 - Renderer: WebGL - Audio: WebAudio - http://phaser.io" phaser.min.js:8SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data phaser.min.js:14
  • The first error about "sourceMappingURL" only happens when using phaser.min.js.
  • The second error about JSON.parse happens with both phaser.min.js and phaser.js.

I'm not sure what else to do to try fixing this.  As I said, it works at 3 other locations, and fails at one.  If this is a hosting issue, I can't call them until tomorrow, which is why I'm checking here to be absolutely sure.

 

Links, in case anyone wants to help troubleshoot.  Just for kicks, I uploaded the final code for  the game from the book, untouched by me, and it still throws a fit:

Any help would be appreciated.

 

Edit:  Apparently I cannot upload JSON files (not sure why I expected it to work, lol), so here's the file's contents.

{ "backgroundcolor":"#4b57ff", "height":17, "layers":[        {         "data":[1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],         "height":17,         "name":"Tile Layer 1",         "opacity":1,         "type":"tilelayer",         "visible":true,         "width":25,         "x":0,         "y":0        }], "orientation":"orthogonal", "properties":    {    }, "tileheight":20, "tilesets":[        {         "firstgid":1,         "image":"tileset.png",         "imageheight":20,         "imagewidth":40,         "margin":0,         "name":"tileset",         "properties":            {            },         "spacing":0,         "tileheight":20,         "tilewidth":20        }], "tilewidth":20, "version":1, "width":25}


 

Link to comment
Share on other sites

Lewster32, Marvster, thank you both for your input.  I tried the three available (ISON, UTF, and ANSI) and none of the three resolved the issue.  I ended up contacting the hosting company, and as it turns out, they don't have a MIME type in the web.config for JSON unless it is requested...after I submitted the ticket, 30 minutes went by and I got a response with a screenshot of the game working!  ;-)  So, I guess we can add that to the list of troubleshooting steps if anyone else has issues...add a MIME type permission in the web.config for JSON files, and you're good to go!

Link to comment
Share on other sites

  • 1 year later...

Nebulocity, firstly sorry for butting in for such a irrelevant problem, but I thought you should know your game suffers the same problem with my problem from here. The game won't load audio files properly on Safari

Phaser.Loader error loading file: bgm from URL null

Phaser.Loader error loading file: jump from URL null

Phaser.Loader error loading file: coin from URL null

Phaser.Loader error loading file: dead from URL null

Followed by TypeError: 'undefined' is not an object (evaluating 'this.masterGain.gain')

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...