JSON to YAML Converter - Convert JSON to YAML Online (Free)

Convert JSON to YAML instantly in your browser. No upload, no sign-up, always free. Paste your JSON and get clean YAML output in one click.

Tool options

Mode

Input
266 chars · 1 lines · 266 bytes
Output

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

  1. Paste your JSON into the left panel (or type it directly).
  2. Click Convert — the YAML output appears on the right.
  3. Click Copy to grab the result, or download it as a .yaml file.

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.

JSONYAML
{
  "service": "api-gateway",
  "port": 8080,
  "tls": true,
  "replicas": 3,
  "env": [
    "production",
    "us-east-1"
  ]
}
service: api-gateway
port: 8080
tls: true
replicas: 3
env:
  - production
  - us-east-1

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 Composedocker-compose.yml files 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.

Frequently asked questions

Is this JSON to YAML converter free to use?+
Yes, completely free. No account, no sign-up, and no usage limits. Just paste your JSON and convert.
Does my JSON get uploaded to a server?+
No. The conversion runs entirely in your browser using JavaScript. Nothing is sent to any server, so it is safe to paste sensitive config, secrets, or internal data.
What is the difference between JSON and YAML?+
Both formats store structured data (objects, arrays, strings, numbers, booleans). JSON uses curly braces, square brackets, and double-quotes. YAML uses indentation instead of braces and drops the quotes for most strings. YAML also allows comments with #, which JSON does not. YAML is more human-readable; JSON is more widely supported for machine-to-machine communication.
Can I convert JSON to YAML in VS Code?+
Yes. Install the 'YAML' extension by Red Hat, then open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and use 'Convert JSON to YAML'. Alternatively, paste your JSON into this tool and copy the result straight into your VS Code file.
What happens to comments in my JSON?+
Standard JSON does not allow comments, so there are none to carry over. After conversion to YAML you can add comments (lines starting with #) manually — that is one of the main reasons people switch from JSON to YAML for config files.
Can this tool handle large JSON files?+
It handles most real-world config files easily. Very large files (tens of megabytes or more) may be slow because the processing happens in the browser's single JavaScript thread. For very large files a command-line tool like yq or a Python script is faster.
The converter says my JSON is invalid — how do I fix it?+
Common causes are trailing commas, missing quotes around keys, or unmatched brackets. Paste your JSON into the JSON Validator for a line-by-line error report, or use the JSON Viewer to visually inspect the structure. Once it is valid, paste it back here.
Is the output YAML 1.1 or YAML 1.2?+
The output follows the YAML 1.2 specification, which is the current standard. YAML 1.2 aligns more closely with JSON (for example, it treats 'true' and 'false' as booleans but no longer treats 'yes'/'no' as booleans, unlike YAML 1.1). This means a valid JSON document is always a valid YAML 1.2 document.