JSON to YAML Converter

Convert JSON to YAML and YAML to JSON.

About this tool

Paste JSON or YAML and get the other one back. The direction is detected automatically, and parse errors point to the line that broke. Handy for Kubernetes manifests, Docker Compose files and CI configs.

How to use it

  1. Paste JSON or YAML into the Input box.
  2. Leave the direction on Detect, or force JSON to YAML or YAML to JSON.
  3. Pick 2 or 4 spaces of indentation.
  4. Copy the output, or click Use output as input to convert it back.

Questions

Is YAML a superset of JSON?
Practically yes: since YAML 1.2, almost any valid JSON document is also valid YAML. The reverse is not true, because YAML has comments, anchors and multi-line strings that JSON cannot express.
What happens to YAML comments when converting to JSON?
They are dropped, because JSON has no comments. Keep the YAML file as your source of truth if the comments matter.
Can I convert a file with several YAML documents separated by ---?
Yes. Each document becomes one element of a JSON array, and the status line says how many documents were found.
Why does “no” turn into false?
Older YAML 1.1 parsers treat words like yes, no, on and off as booleans. This tool uses YAML 1.2 rules where only true and false are booleans, but quote such values if other tools will read the file.

Something not working, or a result looks wrong? Report a problem with this tool