JSON 格式化 Chrome 插件已关闭并注入广告软件。
JSON formatter Chrome plugin now closed and injecting adware

原始链接: https://github.com/callumlocke/json-formatter

## JSON 格式化工具:转向商业模式 流行的 JSON 格式化工具 Chrome 扩展程序的开发者正在从开源开发转向闭源商业模式,以资助一个更全面的 API 浏览工具,该工具具有高级功能。 然而,一个最终的开源版本,**JSON Formatter Classic**,仍然可供那些喜欢它的人使用。此版本提供核心 JSON 格式化功能:快速解析、深色模式、语法高亮、可折叠树以及可点击的 URL – 所有这些都具有最小的性能影响。可以从 Chrome 网上商店安装,或使用 `bun` 从源代码构建。 **重要提示:** 该扩展程序准确地反映了 JavaScript 解析 JSON 的方式,这意味着大数字可能会因 JavaScript 的限制而进行调整(超出 `Number.MAX_SAFE_INTEGER` 的值会受到影响)。由于 V8 的实现,对象键的顺序也可能不同。如果用户想查看原始服务器响应,可以使用“原始”按钮。未来的版本*可能*会包含一个自定义解析器,以突出显示原始 JSON 和解析 JSON 之间的差异。

对不起。
相关文章

原文

I am no longer developing JSON Formatter as an open source project. I'm moving to a closed-source, commercial model in order to build a more comprehensive API-browsing tool with premium features.

I know some users (especially here on GitHub) will always prefer open source tools, so I’m leaving this repo online for others to use/fork, and I’ve published the final open source version as JSON Formatter Classic – you can switch to that if you just want a simple, open source, local-only JSON-formatting extension that won't receive updates.


Chrome extension that helps you view and explore JSON API responses.

  • Fast, even on very long JSON pages
  • Dark mode
  • Syntax highlighting
  • Collapsible trees, with indent guides
  • Clickable URLs
  • Negligible performance impact on non-JSON pages (less than 1 millisecond)
  • Works on any valid JSON page – URL doesn't matter
  • Buttons for toggling between raw and parsed JSON
  • Parsed JSON is exported as a global variable, json, so you can inspect it in the console (now working again!)

Option 1 – Install JSON Formatter Classic from the Chrome Web Store.

Option 2 – Install it from source (see below).

Clone repo and run bun install.

Commands:

  • bun run build - single build
  • bun run watch - same but watch-driven

You can install dist as a local, unpacked extension in Chrome with developer mode enabled.

This turns out to be a complex thing to get right in a bulletproof way. In most cases it's based on the Content-Type header but in some cases it's necessary to inspect the 'page' strucure and see if it looks like a JSON endpoint. This is designed to work as fast as possible with no perceivable impact on browsing.

Why are large numbers not displayed accurately?

This is a limitation of JavaScript and therefore a limitation of JSON as interpreted by your web browser.

  • Anything over Number.MAX_SAFE_INTEGER (2^53 - 1 or 9007199254740991) is adjusted down to that number.
  • Anything below Number.MIN_SAFE_INTEGER (-2^53 + 1 or -9007199254740991) is adjusted up to that number.
  • Extremely precise floating point numbers are rounded to 16 digits.

It's not JSON Formatter doing this, it's the native JSON.parse in V8. JSON Formatter shows you the parsed values, exactly the same as what you'll see if you fetch your JSON from any web application.

If your API endpoint really needs to represent numbers outside JavaScript's safe range, it should quote them as strings.

Why are object keys sometimes in the wrong order?

What you see in JSON Formatter is a representation of the parsed object/array. It's the same order you'll get with Object.keys( JSON.parse(json) ) in JavaScript.

Historically, the JavaScript standard explicitly stated that object keys can be iterated in any order, and V8 took advantage of this by moving numeric string keys (like "1" or "99999") to the top to facilitate a small performance optimisation. This V8 implementation detail has since become standardised.

But I just want to see exactly what the server spits out

For now, your best option is to just use the "Raw" button to see the raw JSON. This is what the server sent. The "Parsed" buttons represents what you'll get from JSON.parse.

In future JSON Formatter might switch from using JSON.parse to a custom parser (if performance allows) in order to detect when a value has been 'changed' by parsing and show an appropriate warning.

联系我们 contact @ memedata.com