JSON ⇄ YAML 转换器 JSON ⇄ YAML Converter
在 JSON 与 YAML 文本之间进行双向格式转换,支持 JSON → YAML 与 YAML → JSON。
Convert between JSON and YAML in both directions: JSON → YAML and YAML → JSON.
1. 输入与转换方向 · Input & Direction
2. 使用小贴士 · Tips for Use
-
1)JSON → YAML:
适合将后端接口返回的 JSON、前端配置文件或日志数据,转换为结构更清晰的 YAML,便于阅读与修改。
Use this when you want to turn API responses, frontend configs or logs into more readable YAML structures. -
2)YAML → JSON:
当你在 Kubernetes、CI/CD 或其他配置文件系统中使用 YAML,而目标程序只接受 JSON 时,可以快速进行格式转换。
When working with YAML in Kubernetes, CI/CD or other config systems but a target program expects JSON, convert here. -
3)错误排查:
若转换失败,本工具会在下方展示错误信息与大致位置(例如第几行)。可根据提示返回编辑器修正。
If conversion fails, the tool shows an error and approximate location (line number). Fix issues in your editor and retry. -
4)语法差异提醒:
JSON 要求所有键名使用双引号,并严格区分布尔值true/false与"true"/"false"字符串; YAML 更宽松,允许缩进表示层级、使用注释等。转换时,请留意这些语法差异带来的变化。
JSON requires quoted keys, strict booleans (true/false) and a very rigid structure; YAML is more flexible with indentation, comments, etc. Watch out for these differences when converting.
说明:本工具使用浏览器端 JavaScript 与开源 YAML 解析库进行转换,不上传数据到服务器。
适用于一般 JSON/YAML 文本转换场景,但不保证涵盖所有极端或非标准写法。
Note: Conversion is done entirely in your browser using JavaScript and an open-source YAML parser.
It is suitable for common JSON/YAML use cases but may not handle every exotic or non-standard edge case.
