Tools

Home
JSON FormatterSQL FormatterJS ValidatorMinify CSS
Merge PDFCompress PDFImage to PDF
JPG to PNGPNG to WebPCrop Image

YAML to JSON Converter

Paste YAML and instantly get formatted JSON — live auto-conversion as you type

Your files never leave your browser
YAML Input0 chars, 0 lines
JSON Output0 chars, 0 lines
Ready·

Paste any YAML — Kubernetes manifests, Docker Compose files, CI configs — and get properly formatted JSON back instantly. Pick 2-space or 4-space indentation, sort keys if you want, and copy or download the result. And everything runs in your browser. Nothing gets uploaded.

How It Works

Paste YAML
→
js-yaml Parses
→
JSON Output

The tool uses the js-yaml library to parse your YAML into a JavaScript object, then serializes it with JSON.stringify() using your chosen indentation. Conversion happens on every keystroke, so you see results as you type. If your YAML has a syntax error, you'll get a red error message pointing to the exact line.

Examples

Simple API Config

Turning a basic app config into JSON for a Node.js server.

INPUT
app: name: my-api port: 3000 debug: false
OUTPUT
{ "app": { "name": "my-api", "port": 3000, "debug": false } }

Docker Compose Service

You need to feed a Docker Compose snippet to a deployment API that expects JSON.

INPUT
services: web: image: nginx:latest ports: - "80:80" - "443:443" environment: - NODE_ENV=production
OUTPUT
{ "services": { "web": { "image": "nginx:latest", "ports": [ "80:80", "443:443" ], "environment": [ "NODE_ENV=production" ] } } }

Kubernetes Pod Spec with Nested Arrays

A real k8s pod definition — the kind of deeply nested YAML that's painful to convert manually.

INPUT
apiVersion: v1 kind: Pod metadata: name: my-pod labels: app: backend spec: containers: - name: api image: node:18 ports: - containerPort: 8080
OUTPUT
{ "apiVersion": "v1", "kind": "Pod", "metadata": { "name": "my-pod", "labels": { "app": "backend" } }, "spec": { "containers": [ { "name": "api", "image": "node:18", "ports": [ { "containerPort": 8080 } ] } ] } }

Who Uses This

👨‍💻 Backend Developers

Converting YAML configs to JSON for REST APIs and microservice settings.

☸️ DevOps Engineers

Turning Kubernetes manifests and Helm values into JSON for debugging or CI/CD pipelines.

📊 Data Analysts

Reformatting YAML data exports into JSON for import into databases or analytics tools.

🎓 Students

Learning the structural differences between YAML and JSON by seeing the same data in both formats side by side.

Common Mistakes

Mixing tabs and spaces

YAML only allows spaces for indentation — tabs will cause a parse error immediately. If your editor uses tabs by default, switch it to spaces (most editors have a setting for this) before pasting.

Forgetting to quote special strings

YAML treats yes, no, true, false, and null as booleans/null, not strings. If you mean the literal text "yes", wrap it in quotes: "yes". Otherwise your JSON output will show true instead of "yes".

Inconsistent indentation levels

If one block uses 2 spaces and another uses 4, the parser gets confused. Pick one indent size and stick with it through the whole file. The converter's error message will point to the exact line where indentation breaks.

Technical Details

Frequently Asked Questions

What happens to YAML comments during conversion?

They're gone. JSON doesn't have a comment syntax, so every comment in your YAML gets stripped out during conversion. If you need to preserve notes, move them into a dedicated field like "_comment" in your JSON structure before converting.

Can I convert JSON back to YAML with this tool?

Yes. Hit the Swap button and it flips direction — JSON on the left, YAML on the right. Same live conversion, same instant results. Works both ways without reloading the page.

Why does my YAML value "true" become a boolean in JSON?

YAML auto-converts bare words like true, false, yes, and no into booleans. If you want the string "true" in your JSON output, wrap it in quotes in the YAML: "true" or 'true'. It is one of the most common gotchas with YAML.

Is there a file size limit?

No server-side limit since it all runs in your browser. That said, extremely large files (tens of thousands of lines) might slow down real-time conversion. For most config files and data exports, you won't notice any lag at all.

Does this handle YAML anchors and aliases?

It does. Anchors (&name) and aliases (*name) get resolved during parsing, so the JSON output contains the actual expanded values. You won't see any anchor/alias syntax in the result — just the duplicated data where it belongs.

Share: