JSON to YAML Converter

Paste JSON on the left and get clean, indented YAML on the right.

About JSON and YAML

JSON is a strict, brace-and-bracket data format used everywhere on the web. YAML is a whitespace-driven, human-readable superset of JSON popular for configuration files (Kubernetes, GitHub Actions, Docker Compose, Ansible). The two map cleanly onto the same data model (objects, arrays, strings, numbers, booleans, null), so most JSON documents convert losslessly into YAML.

What this tool produces

Output is YAML 1.2, generated by js-yaml. Highlights:

  • Block style by default (one key per line), with arrays as - item lists
  • Configurable indent (2 or 4 spaces)
  • No line-wrapping, so long strings stay on a single line
  • Keys that need quoting (reserved words, leading punctuation, embedded colons) are quoted automatically

How it works

Your JSON is parsed with JSON.parse, then serialized to YAML with js-yaml. If the input is not valid JSON, the tool shows the parser error with line and column so you can find it quickly.

Privacy

Conversion runs entirely on your device. The YAML library is fetched once from a public CDN, then your data is parsed and serialized locally. Nothing you paste is uploaded, logged, or sent to a server, so you can safely convert secrets, internal configs, or unreleased data.

Frequently asked questions

Does every JSON document convert cleanly to YAML?
Almost. JSON's data model (object, array, string, number, boolean, null) maps directly to YAML, and js-yaml will quote any keys or values that would otherwise be ambiguous (for example, "yes" as a string instead of a boolean).
Can I preserve comments?
No. JSON has no syntax for comments, so there is nothing in the source to carry over. If you need comments in the output, add them by hand after conversion.
Why are some strings quoted and others are not?
YAML auto-quotes strings that would otherwise parse as a different type (numbers, booleans, dates, null) or that contain characters with special meaning (colons, hash, leading dash). Everything else is left unquoted to keep the output readable.
Can I round-trip back to the same JSON?
Yes for almost all inputs. js-yaml emits a deterministic block style that any YAML 1.2 parser can load back into the same data structure, which then serializes back to identical JSON.