YAML ↔︎ JSON Converter

Convert YAML to JSON or JSON to YAML instantly. Supports complex structures, nested objects, arrays, and multi-line strings. Ideal for Kubernetes configs, CI/CD pipelines, and API schemas. All processing is 100% client-side — your data never leaves your browser.

Direction
JSON indent
YAML indent
Auto-convert
Input · YAML
Output · JSON
❤️ Support CodeConverter.net and donate ❤️

YAML and JSON — when to use each

YAML vs. JSON: complementary formats for different contexts

JSON (JavaScript Object Notation) is the lingua franca of web APIs — compact, universally supported, and trivially parseable in every programming language. It excels in data interchange between services, API payloads, and configuration that needs to be read by machines first and humans second.

YAML (YAML Ain't Markup Language) is a superset of JSON that prioritizes human readability. Its indentation-based structure, support for comments, multi-line strings, and anchors make it a natural fit for configuration files that developers read and edit frequently — Kubernetes manifests, GitHub Actions workflows, Docker Compose files, and Ansible playbooks. The ability to convert freely between the two formats is essential when integrating tools that expect one format with systems that produce the other.

When to use YAML
  • Kubernetes, Helm charts, and Docker Compose
  • GitHub Actions, GitLab CI, and Jenkins pipelines
  • Ansible playbooks and Salt states
  • Any config file a human edits regularly
When to use JSON
  • REST API request and response bodies
  • Package manifests: package.json, composer.json
  • Design tokens and configuration for tools
  • Any data consumed by JavaScript directly
100% private & client-side
  • YAML parsed with a pure-JS parser — no server calls
  • Safe for Kubernetes secrets, tokens, and credentials
  • Zero data transmitted to any server
  • Works offline after initial page load
How to use this tool
  • Choose direction: YAML → JSON or JSON → YAML
  • Paste or upload your file — auto-converts as you type
  • Use Swap to flip input/output instantly
  • Copy or download result as .json / .yaml
YAML pitfalls to avoid
  • Tabs are forbidden — always use spaces for indentation
  • yes/no are booleans, not strings — quote them if needed
  • Norway problem: NO parses as false in YAML 1.1
  • Dates like 2024-01-01 become strings in JSON output
Output formatting options
  • Pretty — indented JSON, easy to read and review
  • Minified — compact JSON, ideal for API responses
  • Both formats are semantically identical
  • Copy or download the result with one click

Important differences between YAML and JSON

While YAML is technically a superset of JSON (valid JSON is also valid YAML), there are important gotchas when converting. YAML supports comments (# comment) which are lost when converting to JSON. YAML anchors (&anchor) and aliases (*alias) allow reusing content — these get expanded on conversion. YAML has several additional scalar types: dates (2024-01-01 becomes a string in JSON), nulls can be written as ~ or null, and booleans accept yes/no/on/off as values (a common source of bugs in Kubernetes configs).