JSON to YAML Converter
Convert JSON to YAML and YAML to JSON for Docker Compose, Kubernetes manifests, GitHub Actions and CI configs. Anchors, merge keys, block strings and multi-document files are handled, strings that look like numbers or booleans stay strings, and anything JSON cannot hold is listed.
Built and maintained by Muhammad Tayyab — Founder, DevPik.
Why Use JSON to YAML Converter?
Docker Compose, Kubernetes manifests, GitHub Actions, and CircleCI all expect YAML. APIs and npm scripts return JSON. Any time you move config between those worlds you need a converter, and config often holds hostnames and secrets you would rather not upload. This converter runs locally, so a map nested inside a list item stays nested, a `run: |` script keeps every line, and strings a parser would read as something else (`y`, `no`, `1.10`, `2024-01-15`) are quoted. Useful when translating an API payload into an Ansible variables file, or the other way when scaffolding a new workflow.
How to Use JSON to YAML Converter
- Paste your JSON into the left input panel. The tool converts it to YAML in real-time as you type.
- Adjust formatting options: choose 2 or 4 space indentation, put arrays of up to five plain values on one line with Inline arrays, or quote every string.
- Click the Swap button to switch to YAML → JSON mode and convert YAML back to JSON. A note under the output lists anything JSON could not keep, such as comments.
- Copy the output to your clipboard or download it as a .yaml or .json file.
Worked Examples
JSON API response → Kubernetes env block
{ "env": [ { "name": "DB", "value": "postgres" } ] }env:
- name: DB
value: postgresOutput is ready to paste into a Deployment manifest's container spec.
YAML config → JSON for an API PATCH
version: 1 settings: debug: true
{
"version": 1,
"settings": {
"debug": true
}
}The JSON uses the indent you pick, 2 spaces here. Comments in the YAML would be removed, and the note under the output says how many.
Preserve multi-line string in YAML
{ "banner": "Line one\nLine two" }banner: |- Line one Line two
The block scalar `|-` syntax is YAML's idiomatic way to preserve newlines.
About JSON to YAML Converter
The JSON to YAML Converter is a free online tool that converts between JSON and YAML formats instantly. JSON (JavaScript Object Notation) and YAML (YAML Ain't Markup Language) are both popular data serialization formats, but they serve different purposes. JSON is the standard for APIs and data exchange, while YAML is preferred for configuration files like Docker Compose, Kubernetes manifests, GitHub Actions workflows, and CI/CD pipelines because of its human-readable syntax and support for comments. Both directions run on js-yaml. They handle nested objects and arrays, nulls, booleans, multi-line block strings, anchors, aliases and merge keys, and files with several documents, and a malformed file is reported with the line and column of the problem instead of being half converted. Customize the output with indent size options and inline array formatting. Everything runs in your browser, so your data never leaves your device.
Troubleshooting & Common Issues
YAML output quotes values that look fine
Some plain words and numbers mean something else to a YAML parser: `true`, `null`, `~`, `1.10` and `2024-01-15` change type, and YAML 1.1 parsers such as PyYAML and Ansible also read `yes`, `no`, `on`, `off`, `y` and `n` as booleans. The converter quotes any string one of these rules would change, so `"no"` stays the text no in every parser. The quotes are not part of the value.
Indentation errors when parsing YAML → JSON
YAML is whitespace-sensitive: a key one space out of line with its neighbours, or a tab used for indentation, breaks the parse. The error message gives the line and column, for example "Line 3, column 5: bad indentation of a mapping entry". Indent with spaces only, 2 or 4 per level, and line each key up with the keys beside it.
Comments from YAML disappeared in JSON
JSON has no comments, so they cannot survive the conversion; the note under the output counts how many were removed. If a note must travel with the data, put it in a field such as `_comment`.
A version like 1.10 turned into 1.1
Unquoted, `1.10` is the number 1.1 to every YAML parser. Going JSON to YAML, the converter quotes `"1.10"` for you. Going YAML to JSON, the value is already a number by the time it reaches JSON, so quote it in the YAML: `version: "1.10"`. A version with two dots, such as `1.2.30`, is not a number and stays text either way.
Frequently Asked Questions
How do I convert JSON to YAML?
Paste your JSON into the left input panel and the tool instantly converts it to YAML in the right panel. You can customize the output with 2 or 4 space indentation, inline short arrays, and string quoting options. Copy or download the result when ready.
Can I convert YAML to JSON?
Yes. Click the Swap button to switch to YAML → JSON mode and paste your YAML in the left panel. Aliases are replaced by full copies of their anchored values, merge keys (<<) are folded into the map, block strings such as a `run: |` script keep every line, and a file with several documents separated by --- becomes a JSON array. Comments are removed because JSON has none, and a note under the output lists everything that could not be kept.
What is the difference between JSON and YAML?
JSON uses braces {} and brackets [] with strict syntax, while YAML uses indentation-based structure that's more human-readable. YAML supports comments, JSON doesn't. JSON is standard for APIs and JavaScript, while YAML is preferred for configuration files (Docker, Kubernetes, GitHub Actions). Both represent the same data structures.
Does the converter handle nested objects and arrays?
Yes. Maps inside lists inside maps, such as a Kubernetes container's resources.limits or a GitHub Actions step's with: block, keep their nesting in both directions, along with arrays of arrays, nulls, booleans, numbers and multi-line strings.
Will the YAML work in Kubernetes, Docker Compose or GitHub Actions?
The output is standard block-style YAML with 2 or 4 space indentation, nested maps under list items and `|` blocks for multi-line strings, which those tools read as-is. Their schema rules (required fields, allowed keys) are not checked, so validate the result with `kubectl apply --dry-run=client -f`, `docker compose config` or your CI's linter.
Is YAML a superset of JSON?
Under YAML 1.2, yes: JSON's braces, brackets and double-quoted strings are all legal YAML, so a YAML 1.2 parser can read a JSON file directly. They still have different conventions and strengths. YAML adds comments, anchors and aliases, and multi-line block strings, none of which JSON supports. This tool converts between their conventional formats.
Is my data safe when converting?
Yes. This JSON to YAML converter runs entirely in your browser. Your JSON and YAML are never sent to a server and stay on your device.
Guides & Further Reading
DeepSeek dsh-superagent: The AI Teammate That Watches Your GitHub Repo and Answers With Pull Requests
DeepSeek's dsh-superagent-prototype is a research prototype for an AI teammate that watches a GitHub repo and does the work while you chat, answering with a pull request. It has 22,373 stars, but it is a prototype, not an official DeepSeek product.
8 min readHA-MCP: Run Your Smart Home by Talking to AI, With 87 Tools for Home Assistant
HA-MCP is an open source MCP server that connects Home Assistant to Claude, ChatGPT and other AI assistants. Talk to your smart home in plain language and it builds automations, fixes broken ones and controls your devices with 87 tools. It has 6,806 stars.
8 min readXML vs JSON — When to Use Which Data Format in 2026
XML and JSON are the two most popular data formats in software development. This comprehensive comparison covers syntax, performance, parsing speed, file size, and when to use each format — with a practical migration guide.
8 min readJSON vs YAML: Complete Comparison Guide for Developers
A comprehensive comparison of JSON and YAML covering syntax differences, comments support, data types, performance, file size, and when to use each format for APIs, configuration files, Kubernetes, and CI/CD pipelines.
10 min readRelated Tools
JSON Formatter Online
Format, beautify, and validate JSON with syntax highlighting, a collapsible tree view, auto-fix for trailing commas and single quotes, search, and JSON-to-XML/CSV/YAML conversion.
XML to JSON Converter
Bidirectional XML ↔ JSON converter with attribute prefixing (@ or _), auto-detection of repeated elements as arrays, CDATA handling, and customizable root element — great for SOAP and RSS.
JSON to CSV Converter Online
Convert JSON arrays to CSV with nested-object flattening (dot-notation columns), configurable delimiters (comma, semicolon, tab, pipe), and one-click download — safe for Excel, Google Sheets, and bulk imports.
JSON Schema Generator
Generate a JSON Schema from sample JSON data with auto-detection of types, format patterns (email, UUID, date, IPv4), required fields, and enum values. Supports Draft 2020-12 and Draft-07 plus validation mode.
YAML Formatter Online
Format, validate, and minify YAML without losing comments, anchors or quoting, with line-precise error reporting that catches indentation mistakes and stray tabs, plus warnings for unquoted version strings, octal-looking numbers and dates. Customize indent size, sort keys, and toggle flow style.
Was this tool helpful?