JSON to YAML Converter
Convert JSON documents to YAML format with syntax validation, clean formatting, and instant preview.
JSON to YAML Converter tool
Example
Input: {"name":"app","ports":[80,443],"debug":false}
Result: name: app / ports: / - 80 / - 443 / debug: false (list items indented 2 spaces)
Object keys become key: value lines and each array item becomes an indented "- " list entry.
How JSON Values Appear in YAML
| JSON value | YAML output |
|---|---|
| "hello" | hello |
| "yes" | 'yes' |
| "true" | 'true' |
| "123" | '123' |
| "2024-01-15" | '2024-01-15' |
| "a: b" | 'a: b' |
| "" | '' |
| 123 | 123 |
| true | true |
| null | null |
| [] | [] |
| {} | {} |
| "line1\nline2" | |- then line1 and line2 indented below |
Each value shown as the value of a key; output from this converter.
- Paste your JSON data into the input panel on the left side.
- The tool validates your JSON syntax and shows an error message if the input is invalid.
- View the converted YAML output in the YAML panel with 2-space indentation and proper structure.
- To convert the other way, edit or paste YAML into the YAML panel and the JSON panel updates.
- Click the copy button to copy the YAML for use in your Kubernetes manifest, Docker Compose file, or CI/CD pipeline.
Converting JSON to YAML for Config Files
This converter rewrites JSON as YAML, the indentation-based format used by Kubernetes, Docker Compose, GitHub Actions and Ansible. {"name":"app","ports":[80,443]} becomes name: app, followed by ports: with each number on its own - line.
Every JSON document is already valid YAML, but hand-written YAML is easier to read because it drops the braces, brackets and most quotes. The converter parses your JSON and writes YAML with 2-space indentation. Arrays become - lists, nested objects become indented blocks, and empty arrays and objects are written as [] and {}. Long lines are never wrapped, and keys keep their original order. Strings are quoted only when they have to be. A string that would change type if left bare, such as "yes", "true", "123" or "2024-01-15", is wrapped in single quotes so any YAML parser still reads it as text. The same goes for a string that contains a colon followed by a space. Multi-line strings become a | block. The table shows these cases.
The panels work in both directions, so you can edit the YAML side and watch the JSON update. If your JSON is invalid, the parser's error appears and the YAML panel keeps its last good result. To tidy YAML you already have, use the YAML Formatter, and for Rust or Python config files, the JSON to TOML Converter.
Sources
Frequently Asked Questions
Related Tools
YAML to JSON Converter
Parse YAML documents and convert to formatted JSON with error reporting and syntax validation.
Developer ToolsJSON Formatter and Validator
Format, validate, beautify, and minify JSON data with a collapsible tree view and line-and-column error detection.
Developer ToolsJSON to XML Converter
Convert JSON data to well-formed XML documents with customizable root element and formatting options.
Developer ToolsJSON to TOML Converter
Convert JSON objects to TOML format with type preservation and clean table structure output.
Developer Tools