Convert JSON to YAML instantly, right in your browser
Paste any JSON object above and get clean, readable YAML back in one click. No sign-up, no uploads — everything runs locally on your device, so your data stays private.
How to use it
- Paste your JSON into the left panel (or type it directly).
- Click Convert — the YAML output appears on the right.
- Click Copy to grab the result, or download it as a
.yamlfile.
Side-by-side example: JSON → YAML
Here is the same small config object written in both formats, so you can see exactly how the conversion maps.
| JSON | YAML |
|---|---|
|
|
Notice what changes: no curly braces, no double-quotes around strings, no commas. YAML uses indentation to show nesting, which makes it much easier to read at a glance — exactly why it is the default format for Kubernetes manifests, Docker Compose files, GitHub Actions workflows, and CI/CD pipelines.
YAML also lets you add comments with # — something JSON does not support at all. That makes it especially useful for config files you share with a team.
Do this in code (Python & JavaScript)
If you need to automate the conversion in your own project, here are the two most common ways.
Python
import json, yaml
with open('config.json') as f:
data = json.load(f)
with open('config.yaml', 'w') as f:
yaml.dump(data, f, default_flow_style=False, sort_keys=False)
Install PyYAML first: pip install pyyaml. The default_flow_style=False flag forces block-style YAML (one key per line) instead of the compact inline style.
JavaScript (Node.js)
const fs = require('fs');
const yaml = require('js-yaml');
const data = JSON.parse(fs.readFileSync('config.json', 'utf8'));
fs.writeFileSync('config.yaml', yaml.dump(data));
Install js-yaml first: npm install js-yaml. The yaml.dump() function handles nested objects, arrays, and all standard scalar types automatically.
How the conversion works
The converter parses your JSON text into a JavaScript object (catching any syntax errors along the way), then serialises that object as YAML using the YAML 1.2 specification. The key rules: objects become indented key-value blocks, arrays become - list items, and strings that are safe to write bare (no special characters) lose their quotes entirely.
If your JSON has a syntax error, the tool flags it before trying to convert — so you always get valid output. For checking and fixing JSON before you convert, the JSON Validator is a handy first step.
When to convert JSON to YAML
- Kubernetes & Helm charts — almost all Kubernetes resource definitions are written in YAML.
- Docker Compose —
docker-compose.ymlfiles are YAML, not JSON. - GitHub Actions / GitLab CI — pipeline workflow files use YAML.
- Ansible playbooks — Ansible reads YAML natively.
- Human-edited config files — YAML is easier to read and supports inline comments.
When to stick with JSON
- APIs and HTTP payloads — JSON is the universal language of REST APIs. YAML parsers are not available in every runtime.
- Data exchange between services — JSON is faster to parse and universally supported. Stick with it here.
- package.json / tsconfig.json — Node.js tooling reads JSON directly; YAML is not a drop-in replacement.
- Anywhere whitespace is risky — YAML is whitespace-sensitive. A single tab instead of spaces breaks a YAML file silently in some parsers.
Need to go the other way? The YAML to JSON Converter works just as fast. And if you want to clean up or compress your JSON before converting, try the JSON Beautifier or the JSON Minifier.
Your JSON never leaves your browser — all processing happens on your device, with zero server uploads. It is safe to paste API keys, internal config, or anything sensitive.
Ready to convert? Paste your JSON into the tool above and get clean YAML back in seconds.