YAML to JSON
Turns YAML configuration into JSON.
Paste JSON to get readable YAML for Docker Compose, Kubernetes, or CI config files. The JSON to YAML converter keeps key order and quotes values that would otherwise change type.
.json file up to 5 MB.[] and empty objects {}.yes, no, on, off, null, true, or number-like text such as 007 or 1.0), and strings with leading or trailing spaces, : , #, or a special first character.| block scalars.Input:
{"server":{"port":8080,"hosts":["a.example.com","b.example.com"]},"debug":false}Output:
server:
port: 8080
hosts:
- a.example.com
- b.example.com
debug: false{"country":"no"} gives country: "no". The quotes stop YAML 1.1 tools from reading it as false.
| JSON | YAML | |
|---|---|---|
| Structure | Braces and brackets | Indentation |
| Comments | Not allowed | Allowed with # |
| Quotes | Required around strings and keys | Usually optional |
| Typical use | APIs and data exchange | Configuration files |
Docker Compose, Kubernetes manifests, GitHub Actions workflows, and Ansible playbooks are all written in YAML. Converting from JSON is handy when an example or an API gives you JSON but the tool wants YAML.
# comments afterwards.YAML 1.2 is designed so that valid JSON is also valid YAML. Converting to YAML's block style makes the file easier for people to read and edit.
Words like "no" or numbers with leading zeros would change type in some YAML parsers. Quoting keeps them as text.
JSON has no comments, so the output has none. You can add # comments to the YAML afterwards.
Often used together with the JSON to YAML.
Turns YAML configuration into JSON.
Beautifies or minifies JSON.
Converts XML into readable YAML, keeping attributes and repeated elements.