Jump to content

JSON parse error on game.load.json() when the file is too large


sonoj
 Share

Recommended Posts

Chrome 45.0.2454.85 on my Win7 throws an exception 

SyntaxError: Unexpected token , at Object.parse (native)

at

    jsonLoadComplete: function (file, xhr) {        var data = JSON.parse(xhr.responseText);       // <-- HERE

when this xhr.responseText exceeds 1MB.   JSON.parse() is the function actually throws an exception.

 

I want to know some smart way of avoiding this 1MB problem .

 

 

Link to comment
Share on other sites

Are you sure the problem is the file size and not an error in the json? As I'm not convinced Chrome has a hard-coded limit for a maximum json size (and if it does I doubt it's as small as 1MB).

 

And I know for a fact Phaser can load json files larger than this, because the Creature Animation data files are several MB in size and load and parse just fine.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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