πŸ”„ YAML ↔ JSON Converter

Bidirectional conversion with inline validation errors.

YAML gotcha: tabs are forbidden for indentation, and unquoted values like yes, on, and 3.10 may parse as booleans or numbers instead of strings. Quote them when you mean text.

How to Use This Converter

Choose a direction, paste your YAML or JSON, and get the converted output instantly. Syntax errors are reported with line numbers so broken Kubernetes manifests, CI configs, and Ansible playbooks get fixed fast. All processing happens in your browser.

1

Pick YAML to JSON or JSON to YAML.

2

Paste the input. Errors show the exact line.

3

Copy the converted output into your config or code.

YAML vs JSON

YAML is designed for humans: indentation-based, comment-friendly, and free of braces and quotes for simple values. That makes it the standard for Kubernetes, Docker Compose, GitHub Actions, and Ansible. JSON is designed for machines: strict, unambiguous, and natively parsed by every programming language, making it the standard for APIs and data interchange.

Every valid JSON document is technically valid YAML (flow style), but the reverse is not true. Converting YAML to JSON is useful when feeding configs into tools that only speak JSON; converting JSON to YAML makes API responses human-editable as config files.

Common YAML Pitfalls

Tabs β†’ forbidden, use spaces only yes/no/on/off β†’ may parse as booleans, quote them 3.10 β†’ parses as number 3.1, quote version strings duplicate keys β†’ last one wins silently

Indentation must be consistent spaces; a single tab character is a syntax error in every YAML parser. The infamous Norway problem: unquoted "NO" parses as boolean false in YAML 1.1. Version strings like 3.10 lose their trailing zero as numbers. This converter's parser follows these rules strictly so surprises surface here, not in production.

Worked Example

Paste "server: port: 8080 tls: true" and YAML-to-JSON produces {"server": {"port": 8080, "tls": true}} with proper types: port as number, tls as boolean. Going the other way, the JSON becomes clean indented YAML with comments preserved where possible.

Tips for Config Files

Validate YAML before applying it: one bad indent can silently change what a Kubernetes manifest means. Keep a canonical JSON copy of critical configs for diffing, since JSON's explicit braces make structural changes obvious. And pin your YAML version: 1.1 and 1.2 disagree on booleans, which has caused real outages.

Frequently Asked Questions

How do I convert YAML to JSON?

Paste your YAML into this tool with YAML to JSON selected. It parses the document, reports any syntax errors with line numbers, and outputs equivalent JSON with correct types.

Is JSON valid YAML?

Yes. The JSON flow style is a subset of YAML, so any valid JSON document parses as valid YAML. The reverse is not true: most YAML uses block style that JSON parsers reject.

Why does my YAML fail with a tab error?

YAML forbids tab characters for indentation. Replace all tabs with spaces (2 or 4 per level, consistently). This is the single most common YAML syntax error.

Why did 'yes' become true in my config?

YAML 1.1 treats yes, no, on, and off as booleans. Quote them ('yes') when you mean the literal string. Country code 'NO' famously parsed as false, breaking configs for Norway.

Should I use YAML or JSON for configs?

YAML for human-maintained configs (readable, commented), JSON for machine-generated data and APIs (strict, fast to parse). Convert between them freely with this tool.