🧾 JSON 格式化校验JSON Formatter
格式化美化、压缩 JSON,校验语法并定位错误行号,还能尝试自动修复尾随逗号等常见问题。数据不出浏览器。Pretty-print or minify JSON, validate syntax with line numbers, and auto-fix issues like trailing commas. Stays in your browser.
① 输入 JSON① Input JSON
users[0].email;查询结果写入输出区。Use dots for object keys and brackets for array indexes, e.g. users[0].email; the result goes to the output.② 输出② Output
③ JSON 对比③ JSON Diff
粘贴两个 JSON 对比差异:~ 修改、+ 新增、- 删除,输出带路径。Paste two JSON documents to diff them: ~ changed, + added, - removed, with paths.
📚 JSON 与 YAML 对比📚 JSON vs YAML
JSON 与 YAML 都是人类可读的序列化格式,但风格不同:JSON 必须用双引号与花括号/方括号,机器友好、无歧义、可直接 `JSON.parse`;YAML 用缩进表达层级、允许裸字符串,读起来更接近配置文件,广泛用于 CI(GitHub Actions)、K8s 与 Docker Compose。二者可以无损互转(本工具的「转为 YAML」即为此)。JSON and YAML are both human-readable serialization formats with different styles: JSON requires double quotes, braces and brackets — machine-friendly, unambiguous, directly parseable; YAML uses indentation for hierarchy and bare strings, reading more like a config file, widely used in CI (GitHub Actions), Kubernetes and Docker Compose. The two convert losslessly (that’s what “To YAML” does here).
注意:YAML 的「裸字符串」有时会被误判为布尔/数字(如 yes/on/2026-01-01),因此本工具在字符串看起来像数字或含特殊字符时自动加引号,避免语义漂移;反过来从 YAML 转 JSON 时应使用经过验证的解析器。JSONPath(本工具支持)则用于在 JSON 内部按路径取数,与格式转换互补。Note: YAML’s bare strings can be misread as booleans/numbers (e.g. yes/on/2026-01-01), so this tool auto-quotes strings that look numeric or contain special characters to avoid semantic drift; conversely use a validated parser when going from YAML to JSON. JSONPath (also supported here) locates values by path inside JSON — complementary to format conversion.
使用说明How to use
- 粘贴 JSON 文本Paste JSON
- 格式化美化、压缩、按键排序或扁平化Prettify, minify, sort keys or flatten
- 校验语法并定位错误行号Validate and locate errors
示例:压缩的 JSON → 缩进美化Example: Compact JSON → pretty-printed
全程在你的浏览器本地完成,文本不会上传服务器。Runs entirely in your browser; your text is never uploaded.