JSON 格式化

美化 JSON,可配置缩进

Loading editor...

Format raw payloads before you debug them

When an API response arrives minified or deeply nested, formatting is the fastest way to make the structure readable. It turns a one-line blob into something you can scan, diff, review, and share without losing the original data.

Use the formatter when you need to

Pretty-print a minified response

Expand compressed JSON so nested arrays, objects, and values are easy to inspect.

Normalize fixtures before code review

Apply consistent indentation and optional key sorting so diffs stay clean and predictable.

Prepare payloads for docs or tickets

Share readable request and response examples without manually editing whitespace.

How to format JSON quickly

  1. 1

    Paste the JSON payload or upload a file.

  2. 2

    Choose 2 spaces, 4 spaces, or tabs and enable key sorting if needed.

  3. 3

    Click Format, then copy the cleaned result or download it for reuse.

Common formatter workflows

Copy a broken response from devtools

Format it first so the bad field, missing quote, or odd nesting becomes obvious.

Clean up JSON before sending it to a teammate

Readable payloads reduce back-and-forth when you need help debugging an integration.

Review production config or fixture changes

Stable formatting makes structural changes easier to spot during reviews and deployments.

相关工具

常见问题

把 JSON 粘贴到编辑器里,点击 Format 即可。缩进可选 2 空格、4 空格或 tab。工具完全在浏览器本地运行,不会把内容发送到服务器。

先确认 JSON 本身是合法的。常见问题包括:括号/大括号没闭合、末尾多了逗号(trailing comma)、key 没加双引号、用单引号代替双引号等。可以试试我们的 JSON Repair 工具自动修复这些问题。

可以。格式化后启用 Sort Keys,会对整个 JSON(包含所有嵌套对象)里的 key 进行字母序排序。

安全。JSONTech 用 JavaScript 在你的浏览器里本地处理数据,不会上传到任何服务器。你也可以在浏览器的 Network 面板里自行验证。

没有区别,本质是同一件事。JSON Formatter / JSON Beautifier / JSON Pretty Printer 都是指给压缩的 JSON 加上缩进和换行,让它更易读。