Nathan
Nathan

Reputation: 11

eval json out of memory error

I'm using JSON.parse function to load info about a cellset. I'm testing how much data is possible to fetch in one call.

The eval function starts throwing "out of memory" between 1.3-1.4 million characters (65,000-70,000 cells) in the JSON string. Does anybody know of a workaround for this - perhaps a pure JSON parser, rather than eval?

Thanks, Nathan

Upvotes: 1

Views: 1417

Answers (2)

Ryan Doherty
Ryan Doherty

Reputation: 38740

You are definitely pushing way too much information to your client.

Possible workarounds:

  • Page your data and only load what is visible
  • Avoid JSON, use HTML and dump the HTML directly to the page with .innerHTML
  • Maybe use a native JSON parser like in Firefox and IE8 (possibly in other browsers, can't remember)
  • Try JSONP (including a script tag that calls a function with your data as an argument)

Upvotes: 1

giolekva
giolekva

Reputation: 1178

I would recommend this one: http://json.org/js.html it's efficient.

Upvotes: 1

Related Questions