JSON to YAML Converter
Convert JSON to clean, readable YAML with indentation and hierarchy control
Write config files in YAML instead of JSON
YAML drops most of the braces, quotes and commas that make JSON tiring to hand-edit, which is why Kubernetes manifests, CI pipelines, Docker Compose files and many other configs use it. This converter takes valid JSON and re-writes it as YAML using the js-yaml library, loaded from a CDN when the page opens, so an internet connection is needed for the conversion to work.
Converting a document
- Paste JSON into the JSON Input box. Sample loads an app configuration with server, database, feature list and contacts; Paste pulls from the clipboard.
- Pick a YAML Indent of 2 or 4 spaces.
- Optionally tick Sort Keys to order keys alphabetically, and Compact Arrays to collapse nested structures onto single lines.
- Press Convert to YAML.
A status badge shows whether the input was valid JSON. Below it you see input and output sizes in bytes. Use Copy or the YAML button, which saves output.yaml.
What the two checkboxes really do
Sort Keys is handy when you want consistent diffs between versions of a config file, since the same content always produces the same order. Compact Arrays asks the library to switch to inline flow style once nesting reaches the third level, so top-level and second-level entries stay in block style, while deeper lists and objects are written like [a, b] or {x: 1}. Try it on the sample to see where the line falls.
Everyday situations
- Converting an API response or package manifest into YAML for documentation.
- Starting a Kubernetes or Compose file from a JSON snippet someone sent you.
- Comparing two configs by normalizing them into sorted YAML.
- Making a long JSON settings file more readable for review.
Notes and limits
Only JSON is accepted as input, and comments are not allowed in JSON, so remove them first. When the JSON is invalid, the result box displays the parser error and the badge says Invalid JSON. Key order is preserved unless you enable sorting. YAML output uses whichever quoting style the library judges necessary, so some strings that look like numbers or booleans will be quoted to remain strings. If the page cannot reach the CDN because of a network or content-blocker issue, the conversion will fail until the script loads.
Related Tools