eval json内存不足错误

发布于 2024-08-08 11:58:48 字数 189 浏览 5 评论 0原文

我正在使用 JSON.parse 函数加载有关单元格的信息。我正在测试一次调用可以获取多少数据。

eval 函数开始在 JSON 字符串中的 1.3-140 万个字符(65,000-70,000 个单元格)之间抛出“内存不足”的错误。有谁知道这个问题的解决方法 - 也许是一个纯 JSON 解析器,而不是 eval?

谢谢, 内森

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

⊕婉儿 2024-08-15 11:58:48

我推荐这个: http://json.org/js.html 它很有效。

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

你丑哭了我 2024-08-15 11:58:48

您肯定向客户推送了太多信息。

可能的解决方法:

  • 分页数据并仅加载可见内容
  • 避免 JSON,使用 HTML 并将 HTML 直接转储到带有 .innerHTML 的页面
  • 也许使用本机 JSON 解析器,如 Firefox 和 IE8(可能在其他浏览器中,不记得了)
  • 尝试 JSONP(包括使用您的数据作为参数调用函数的脚本标记)

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)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文