JSON ↔ YAML Converter
Convert configuration between JSON and YAML, instantly and offline. Preserves anchors, references, and unicode characters.
JSON, YAML, and when to use which
JSON and YAML solve overlapping problems — both describe structured data — but they have different cultural homes. JSON dominates wire formats and APIs because it is unambiguous, fast to parse, and supported by every language standard library. YAML dominates configuration files (Kubernetes manifests, CI pipelines, Ansible playbooks) because it is more compact, supports comments, and reads more like prose.
Every JSON document is a valid YAML document — YAML is a strict superset. Converting from JSON to YAML almost always produces a usable result. Converting from YAML to JSON occasionally loses information: comments are dropped, tags are normalised, and node-anchor references are flattened. This tool uses js-yaml, the most widely deployed YAML 1.2 parser for JavaScript, and runs entirely inside your browser tab.
Use cases
- Translate a Kubernetes ConfigMap from YAML to JSON to feed it through jq.
- Convert a JSON OpenAPI spec to YAML for human-friendly review.
- Quickly reformat a CI pipeline definition copied from someone else's repository.
- Validate that a YAML file parses without ambiguity before committing.
- Convert a JSON snippet to YAML when writing GitHub Actions or Helm values.
Best practices
- Avoid YAML's optional flow style for human-edited configs — block style scales better.
- Always quote strings that look like numbers, booleans, or dates (YAML's "Norway problem").
- Pick a single indentation level (two spaces is conventional) and enforce it via a linter.
- When precision matters, prefer JSON — YAML 1.1 historically interpreted on/off/yes/no as booleans.