JSON ↔ YAML 转换
在线 JSON 转 YAML / YAML 转 JSON。浏览器端转换,数据不上传。
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.
怎么使用
- Pick mode: JSON → YAML or YAML → JSON
- Paste your input
- Result appears on the right; copy or download
常见用例
- Converting K8s manifests from JSON (kubectl get -o json) to editable YAML
- Turning package.json into a .yaml for CI consumption
- Learning the differences by side-by-side conversion
- Converting YAML back to JSON for API submission
常见问题
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.