How to use the JSON to YAML
- 1
Paste JSON into the left pane, drop a .json file onto it, or press Sample. The YAML appears on the right as you type.
- 2
Choose 2 or 4 space indentation to match your project's style.
- 3
Fix any syntax error the status line reports; the exact spot is underlined in the editor.
- 4
Press the swap button to convert YAML back to JSON, with pretty or minified output.
- 5
Copy the result or download it as a .yaml file.
Features
- Converts JSON to YAML 1.2 and back, live as you type
- Quotes strings that YAML would otherwise read as numbers, booleans or null
- Never folds long strings, so values stay on one line and remain searchable
- 2 or 4 space indentation for YAML, pretty or minified JSON on the way back
- Multi-document YAML streams become a JSON array, one element per document
- Syntax errors are reported with line and column and underlined in the editor
- Detects the format of a pasted file and switches direction for you
- Runs entirely in your browser; nothing is uploaded
Why convert JSON to YAML
Configuration formats have settled on YAML: Kubernetes manifests, GitHub Actions workflows, Docker Compose files, OpenAPI specs and CI pipelines all read it. Data still arrives as JSON, from APIs, from exports and from code. Converting lets you take a JSON structure you already have and drop it into a YAML file without retyping it, and the result is usually easier to read, with no braces, fewer quotes and comments allowed once it is in place.
The converter writes YAML the way a careful person would: block style for maps and lists, strings unquoted unless quoting is needed to preserve their type, and no line folding, so a long URL or token stays on one line where search and diff tools can find it.
Converting YAML back to JSON
The swap button reverses the direction. YAML’s extra features are resolved rather than rejected: anchors and aliases are expanded, merge keys are applied, and a stream of several documents becomes a JSON array. Indentation mistakes, the most common YAML problem, are reported with the exact line and column and underlined in the editor, which makes this a quick way to validate a manifest before committing it.
Related tasks
To turn JSON into a table for a spreadsheet, use JSON to CSV. To check JSON structure before converting, the JSON Validator gives a detailed error report.
Frequently asked questions
Is YAML a superset of JSON?
Why are some strings quoted in the YAML output?
Do comments survive the conversion?
Can I convert a Kubernetes or Docker Compose file with several documents?
How are dates and special numbers handled?
Is my data uploaded anywhere?
Last updated .