免费 · 开发
JSON 格式化.
格式化、校验、压缩和浏览 JSON,可精确定位错误、自动修复、按键排序并以可折叠树形视图查看。
✓ Valid JSON · 316 bytes · 13 keys · 5 objects · 1 arrays · depth 4
Large numbers are kept exactly as written (they exceed JavaScript’s safe integer range).
Formatting works on the original text, so key order and every digit are preserved; validation follows the strict JSON standard (RFC 8259). Nothing is uploaded.
格式化并校验 JSON
- 粘贴 JSON 或打开 .json 文件(最大 20 MB),输入时即自动校验并格式化。
- 选择 2 空格、4 空格、制表符或压缩输出。可按需排序键,或切换到可折叠的树状视图。
- 如果 JSON 无效,可查看错误所在的确切行列及通俗说明,或使用自动修复。
- 复制结果或下载为 .json 文件。
示例:缺少逗号时会提示“line 3, column 2: a comma is probably missing”,并显示该行。自动修复可处理常见错误,如末尾多余逗号、单引号和注释。
为什么结果可靠
- 校验遵循严格的 JSON 标准(RFC 8259)。
- 重新缩进会保留原始键顺序和每一位数字,包括超出 JavaScript 表示范围的大整数。只有排序键时才会重新解析数据。
- 统计信息显示大小、键、对象和数组的数量以及嵌套深度。树状视图最多显示 4,000 个节点。
- 您的 JSON 不会离开浏览器。比较两个文档请使用 JSON 对比;转换为 YAML 请使用 JSON 与 YAML 互转。
限制与支持格式
输入内容在您的设备上处理。
英语技术说明
Files up to 20 MB. Formatting keeps the original key order and every digit, including integers larger than JavaScript can represent; sorting keys re-parses the data. The tree view shows up to 4,000 nodes.
Strict RFC 8259 validator with precise line/column errors and plain-language explanations (trailing commas, single quotes, comments, missing commas), automatic repair of common mistakes, lossless re-indentation, minification, key sorting, statistics (size, keys, objects, arrays, depth), a collapsible tree, copy and .json download.
{"a":1,"b":[1,2]} → formatted with 2 spaces; a missing comma is reported as “line 3, column 2: a comma is probably missing” with the line shown.
常见问题
能修复损坏的 JSON 吗?
通常可以。自动修复能处理末尾逗号、单引号、注释和缺失逗号等常见错误。请务必检查结果。
会改动我的大数字吗?
不会。格式化会保留每一位数字,即使是 JavaScript 无法精确表示的大整数。只有排序键时才会重新解析数据。
我的 JSON 会被上传吗?
不会。校验和格式化完全在您的浏览器中进行。