What is a JSON to YAML converter?
JSON and YAML describe the same kinds of data, objects, lists, strings, numbers and booleans, in different styles. JSON is stricter and common in APIs; YAML is easier for people to read and write, which is why Kubernetes, Docker Compose, GitHub Actions and many CI systems use it for configuration.
This converter switches between them in either direction, with your choice of indentation. Parse errors show the reason and location, which helps with YAML's whitespace rules. The conversion happens in your browser, so configs with internal hostnames never leave your device.
How to use the JSON ↔ YAML Converter
1.Pick a direction
JSON to YAML or YAML to JSON.
2.Paste your data
A config file, a manifest or an API payload.
3.Copy or download
Choose 2 or 4-space indentation and take the result.
Example: a service config
The sample JSON becomes this YAML:
- Line 1
- service: api
- Line 2
- replicas: 3
- Lines 3–5
- ports:, - 80, - 443
- Lines 6–8
- env:, NODE_ENV: production, DEBUG: false
The same data takes 12 lines as pretty-printed JSON and 8 as YAML, with the same meaning.
YAML is a superset of JSON
Every JSON document is valid YAML 1.2, so converting JSON to YAML only changes the style: braces and quotes give way to indentation and dashes. Going the other way, YAML features with no JSON equivalent, such as comments and anchors, are resolved or dropped.
The conversion uses the yaml library, which follows YAML 1.2, where yes and no are plain strings rather than booleans. That avoids the classic Norway problem, where the country code NO turned into false in YAML 1.1 parsers.
Frequently asked questions
Are YAML comments kept?
Not when converting to JSON, which has no comments. Converting JSON to YAML can't add any either.
Why is indentation so important in YAML?
YAML uses indentation for structure, like Python. A wrong indent changes the meaning or causes an error, and tabs aren't allowed.
Can I convert a Kubernetes manifest?
Yes. Single documents convert directly; for a file with several documents separated by ---, convert one at a time.
Is JSON valid YAML?
Yes, under YAML 1.2. That's why a YAML parser can read most JSON files unchanged.
Related tools
JSON Formatter & Validator
Pretty-print, minify, sort and validate JSON with line-numbered errors.
JSON ↔ CSV Converter
Convert JSON arrays to CSV and CSV back to JSON.
JSON to TypeScript Interface Generator
Generate TypeScript interfaces or types from a JSON sample.
Base64 Encoder & Decoder
Base64 and Base64url for text (UTF-8) and files.
URL Encoder & Decoder
Percent-encode or decode URLs and query values, and see a URL's parts.
JWT Decoder
Decode a JSON Web Token's header and payload and check its expiry.