是否有任何工具/技巧/插件可以帮助我计算谷歌浏览器本身的 JSON URL 中的对象数量

Are there any tools/tricks/plugins that help me count the number of objects there are in a JSON url in Google Chrome itself?

本文关键字:JSON URL 对象 谷歌浏览器 技巧 工具 任何 插件 是否 帮助 计算      更新时间:2023-09-26

例如在 json url https://api.github.com/users/mralexgray/repos

我想知道主数组中有多少对象,而不必离开 chrome。

您可以使用

Object.keys(obj).length,其中obj是从API返回的JSON。

您可以请求该数据,然后计算返回的 JSON 数组中的记录数。您可以打开 Chrome 开发工具(默认为 F12)并将以下代码粘贴到控制台中。

fetch('https://api.github.com/users/mralexgray/repos').then(response => response.json().then(data => console.log('Records: ' + data.length)))

或者,您可以通过加载在浏览器中打开链接,然后在对象中搜索唯一键(如"full_name")来手动执行此操作。