views:

156

answers:

2

Hi,

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

+1  A: 

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

giolekva
+1  A: 

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)
Ryan Doherty