JSON 格式化
美化、压缩、校验 JSON 文本,结果可一键复制或下载。
Ctrl / ⌘ + Enter 快速执行当前操作
输入 JSON
结果输出
请输入 JSON 内容
本工具所有运算在本地浏览器完成,你的文件、文本不会上传到服务器
工具介绍
JSON 格式化把压成一行的接口返回、日志片段重新排版,缩进、换行和引号都恢复成可读结构;也能反向压缩,把格式化好的内容收成一行,方便贴进请求体或配置文件。 JSON formatting lays out a single-line API response or log fragment again, restoring indentation, line breaks and readable structure. It also compresses the other way, folding pretty-printed JSON into one line for a request body or config file.
解析失败时会指出出错位置并给出附近的片段,方便定位多余的逗号、缺失的引号这类常见问题,而不是只丢一句“格式错误”。 When parsing fails, the tool points at the offending position and shows the surrounding fragment, so a stray comma or missing quote is easy to find — not just a bare “invalid” message.
- 两格缩进排版Two-space indentation
- 一键压缩为单行Compress to a single line
- 语法校验与错误定位Syntax check with error position
- 结果复制与下载Copy or download the result
使用说明
- 把 JSON 粘贴到左侧输入框,或点击“示例数据”快速试用。Paste JSON into the left editor, or load the sample data to try it.
- 选择“格式化”或“压缩”,也可以直接按 Ctrl / ⌘ + Enter。Choose Format or Compress — Ctrl / ⌘ + Enter does the same thing.
- 在右侧查看结果;如果有语法错误,会标出出错位置。Read the result on the right; syntax errors are marked with their position.
- 复制结果到剪贴板,或下载成 .json 文件。Copy the result, or download it as a .json file.
常见问题
支持带注释的 JSON 吗?Does it accept JSON with comments?
不支持。注释、尾随逗号都属于 JSON5 的写法,标准 JSON 解析会报错;需要先去掉注释再格式化。No. Comments and trailing commas belong to JSON5; standard JSON parsing rejects them, so remove them first.
大文件会不会卡住?Will a large file freeze the page?
几 MB 的 JSON 通常没有问题,超大文件受浏览器内存限制,建议拆分成几段分别处理。A few MB is usually fine. Very large files are limited by browser memory — split them into chunks.
内容会被保存吗?Is my content stored anywhere?
不会。所有内容只在当前页面内处理,刷新或关闭页面即清空。No. Everything stays in the current page and is cleared when you refresh or close it.