开发者

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 fetc开发者_运维问答h 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


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


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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜