JSON ↔ YAML 转换

在线 JSON 转 YAML / YAML 转 JSON。浏览器端转换,数据不上传。

广告位 — Google AdSense

JSON ↔ YAML Converter — Online Format Translator

工具介绍

JSON and YAML are the two dominant data-serialization formats. JSON is concise and machine-friendly; YAML is human-readable and supports comments — used heavily in Kubernetes, Docker Compose, CI/CD, and Ansible. This tool converts both directions, preserving nested structures, arrays, and booleans.

怎么使用

  1. Pick mode: JSON → YAML or YAML → JSON
  2. Paste your input
  3. Result appears on the right; copy or download

常见用例

常见问题

Q: YAML supports comments but JSON doesn't — what happens?
A: Comments are dropped on conversion. Keep the original YAML file as source of truth.

Q: Quote style differences?
A: Default is block style (no quotes). Use quoted strings explicitly when needed.

Q: Big files?
A: Bounded by browser memory; up to ~1 MB is smooth.

小贴士

JSON requires double quotes. YAML is flexible but indentation-sensitive.

In YAML, yes/no/on/off are booleans — quote explicitly if you need strings.

Schema validation: YAML via js-yaml, JSON via AJV.