jQuery 在 Chrome 中检查大型 JSON 数据

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8298165/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 10:18:56  来源:igfitidea点击:

Inspecting large JSON data in Chrome

jqueryajaxjsongoogle-chromegoogle-chrome-devtools

提问by Nyxynyx

There is a page on my website that uses jquery AJAX to request JSON data from the PHP backend. I want to view the JSON returned to the browser, and is trying to do so using Chrome browser's Developer tools, under Network> Response.

我的网站上有一个页面使用 jquery AJAX 从 PHP 后端请求 JSON 数据。我想查看返回到浏览器的 JSON,并尝试使用 Chrome 浏览器的开发人员工具,在Network> Response.

Problem:Although I am able to view the JSON data by selecting the XHR item there, the response appears to be cut off midway. According to Chrome, this JSON response is 300-400KB in size. I wonder whether if the webpage is receiving the full JSON response without truncation, and if not, how can I view the full data being received?

问题:虽然我可以通过在那里选择 XHR 项目来查看 JSON 数据,但响应似乎在中途被切断。根据 Chrome 的说法,这个 JSON 响应的大小为 300-400KB。我想知道网页是否正在接收没有截断的完整 JSON 响应,如果没有,我如何查看正在接收的完整数据?

采纳答案by Adam Rackis

Have you tried the "preview" tab - it lets you view your result as a proper JavaScript object, with the ability to expand nodes. It's much easier to work with than the raw text from the response tab.

您是否尝试过“预览”选项卡 - 它可以让您将结果作为适当的 JavaScript 对象查看,并具有扩展节点的能力。它比响应选项卡中的原始文本更容易使用。

enter image description here

在此处输入图片说明

回答by ajreal

回答by Matt McClure

To see the complete response:

查看完整回复:

  1. Navigate to Developer Tools > Network > the given response > Response tab.
  2. Right click (control-click on Mac) in the Response area > Save As
  1. 导航到开发人员工具 > 网络 > 给定的响应 > 响应选项卡。
  2. 在响应区域中右键单击(在 Mac 上按住 Control 单击)> 另存为

Response >Save As

响应 >另存为

Screenshot from Version 24.0.1312.57 on Mac.

Mac 上版本 24.0.1312.57 的屏幕截图。

回答by ElephaniousBrookwood

I'm a little late to the party here but if you are at a breakpoint you can type the object name in and press "Enter" and the JSON object will be printed to the console window.

我在这里参加聚会有点晚了,但是如果您在断点处,您可以输入对象名称并按“Enter”,JSON 对象将被打印到控制台窗口。