How to convert JSON to YAML
- 1Paste your JSON into the JSON Input panel. Conversion runs automatically a moment after you stop typing.
- 2Check the badge next to the panel title. Valid JSON means the input parsed; Invalid JSON shows a banner with the parser's error so you can find the problem.
- 3Read the result in the YAML Output panel, written with 2-space indentation and the same key order as your JSON.
- 4Click Copy to put the YAML on your clipboard, or Download to save it as converted.yaml.
JSON vs. YAML: what changes when you convert
JSON and YAML describe the same data model: maps, lists, strings, numbers, booleans and null. YAML 1.2 was designed so that any valid JSON document is also valid YAML, which is why conversion in this direction is lossless. What changes is the syntax. Braces and brackets give way to indentation, list items start with a dash, and most quotes disappear.
Not all quotes go away, though. A YAML parser guesses the type of every unquoted value, so a string like "123", "true", "null" or "1.0" would turn into a number, boolean or null if it were written bare. The converter keeps quotes on those strings, and on strings that contain characters with special meaning in YAML, such as ": ", "#" or a leading "-". That is the main reason hand-converted YAML breaks, and the main reason to use a tool for it.
Multi-line strings are written as YAML block scalars (using | or >) instead of one long line full of \n escapes, and long strings may be folded across several lines. Both forms load back to exactly the same value, so they are safe to commit as-is.
The most common reason to convert is configuration. Kubernetes manifests, GitHub Actions workflows, Docker Compose files, Helm values and OpenAPI specs are usually written in YAML, while the data you start from, such as an API response, a generated config or a kubectl -o json dump, is often JSON. The conversion uses the js-yaml library and runs entirely in your browser, so nothing you paste leaves your machine.
When developers reach for it
Converting JSON to Kubernetes YAML
Turn the output of kubectl get -o json, or a JSON example from the docs, into YAML you can edit and apply.
Converting OpenAPI specs
Many generators emit OpenAPI as JSON. Convert it to YAML when your repo or docs tooling expects openapi.yaml.
Moving app config to YAML
Migrate a JSON settings file to YAML so your team can add comments and read it without counting braces.
Building CI workflows
Sketch a matrix or job definition as JSON, then convert it into the YAML that GitHub Actions or GitLab CI expects.
Frequently asked questions
Is all JSON valid YAML?
+
Under YAML 1.2, effectively yes: YAML was extended to be a superset of JSON. You still convert because block-style YAML is far easier to read and edit than JSON pasted into a YAML file.
Why are some strings quoted in the YAML output?
+
Strings that look like numbers, booleans or null, or that contain YAML syntax characters like ": " or "#", are quoted so they stay strings when the YAML is parsed again. Without the quotes, "8080" would load as a number and "true" as a boolean.
Does the converter keep my key order?
+
Yes. Keys appear in the YAML in the same order they appear in your JSON. Nothing is sorted.
Can I add comments to the output?
+
JSON has no comments, so the generated YAML has none either. Once you copy or download the YAML you can add # comments anywhere you like.
Is converting JSON to YML any different?
+
No. .yml and .yaml are two file extensions for the same format, and YAML tools read both. The output is identical; the download is named converted.yaml, so rename it to .yml if your project uses that extension.
Is my JSON uploaded to a server?
+
No. Parsing and conversion run in your browser with JavaScript, so it is safe to paste configs that contain internal hostnames or credentials.
Related tools
YAML to JSON Converter
Convert YAML configuration files to JSON format with syntax validation and error checking.
JSON Formatter
Format and beautify JSON data with syntax highlighting and validation.
JSON to CSV Converter
Convert JSON arrays to CSV and CSV back to JSON. Handles quoted commas and multi-line fields, flattens nested objects to dot-path columns, and supports comma, semicolon, tab and pipe delimiters.
Base64 Decoder & Encoder
Encode text or files to Base64 format or decode Base64 strings.