How to use YAML ↔ JSON Converter
The YAML to JSON Converter translates YAML configuration and data files into JSON and back again, validating syntax in both directions and reporting errors with line numbers. YAML is the dominant format for Kubernetes manifests, CI/CD pipelines (GitHub Actions, GitLab CI), Ansible playbooks, and Docker Compose files; JSON is required by most REST APIs and configuration schemas. Switching between the two formats is a daily task for DevOps engineers and backend developers. Everything runs in your browser — no uploads.
- Paste your YAML content into the input panel, or paste JSON to convert in the reverse direction.
- The tool automatically detects the input format — look for the "Detected: YAML" or "Detected: JSON" indicator.
- Click Convert to YAML or Convert to JSON depending on your target.
- If the input contains syntax errors, an inline error message shows the line number and description.
- Review the output — YAML uses indentation for structure while JSON uses braces and quotes.
- Copy the result or download it with the appropriate .yaml or .json extension.
Your data never leaves your device — 100% private processing.
YAML syntax features and gotchas
YAML (YAML Ain't Markup Language) is a superset of JSON — any valid JSON is also valid YAML 1.2. However, YAML adds significant extra syntax. Indentation (spaces only, never tabs) defines structure. Strings do not require quotes unless they contain special characters — but unquoted strings starting with true, false, yes, no, on, off, or resembling numbers are automatically coerced to booleans or numbers in YAML 1.1 (used by the popular js-yaml library), which catches many engineers by surprise. Always quote values like "true" when you intend a string. Anchors (&name) and aliases (*name) provide YAML-level de-duplication that has no equivalent in JSON.
| Concept | YAML | JSON |
|---|---|---|
| Object / map | key: value (indented) | {"key": "value"} |
| Array / sequence | - item (indented) | ["item"] |
| String | no quotes needed (usually) | "must be double-quoted" |
| Boolean | true / false (also yes/no in 1.1) | true / false |
| Null | null or ~ or empty | null |
| Multiline string | | (literal) or > (folded) | Escape \n in one-liner |
| Comments | # comment | Not supported |
| Anchors & aliases | &anchor / *alias | Not supported |
YAML versions and compatibility
YAML 1.1 (released 2005) is what most tools historically implement: it includes the yes/no/on/off boolean coercions and a broader set of scalar implicit types. YAML 1.2 (2009, updated 2021) aligns more closely with JSON and removes the yes/no/on/off booleans to reduce surprise coercions — only true and false are booleans. PyYAML defaults to 1.1; Go's gopkg.in/yaml.v3 uses 1.2. When writing Kubernetes manifests or Helm charts, assume YAML 1.1 semantics because the Go library underpinning them still uses that version in many distributions. Always validate critical YAML files with a schema (e.g. JSON Schema via the YAML Language Server in VS Code) to catch coercion issues before deployment.
Worked examples
YAML to JSON
Inputs: name: Al / age: 30
Result: {"name":"Al","age":30}
Boolean coercion trap
Inputs: country: NO (unquoted)
Result: becomes false in YAML 1.1 — quote it to keep a string
JSON to YAML
Inputs: {"items":[1,2]}
Result: items: then "- 1" and "- 2" on indented lines
Glossary
- YAML
- YAML Ain't Markup Language — a human-readable data serialisation format designed for configuration files and data exchange.
- Anchor
- A YAML label (&name) that marks a node for reuse; the node is referenced elsewhere in the document with an alias (*name).
- Scalar
- A single YAML value: a string, number, boolean, or null — as opposed to a mapping (object) or sequence (array).
- Block style
- The YAML syntax using indentation to represent structure — the typical multi-line format used in config files.
- Flow style
- The JSON-like inline YAML syntax using {} and [] that can be used inside block-style documents for compact one-liners.
Related reading
Frequently Asked Questions
Why use YAML ↔ JSON Converter?
- Convert YAML to JSON to validate a Kubernetes manifest or CI config against a JSON Schema
- Convert JSON back to YAML to produce a human-readable config from a generated output
- Detect and report YAML syntax errors with the line number before a deployment fails
- Handle YAML 1.1 boolean coercions (yes/no/on/off) that trip engineers switching between tools
Common use cases
- Convert a docker-compose.yml to JSON to validate it against the Compose JSON Schema
- Transform a GitHub Actions workflow YAML to JSON to debug a conditional expression
- Convert a Helm values.yaml to JSON to pipe it into a jq query during chart debugging
- Translate a Kubernetes ConfigMap YAML to JSON for import into a configuration management API
- Debug a YAML parsing error in an Ansible playbook by checking the converted JSON structure
Get weekly tool tips & updates
New tools, power-user tips, and productivity hacks — delivered free every Friday.
No spam, ever. Unsubscribe with one click.
Related Developer Tools
JSON Formatter & Validator
Format, validate, and minify JSON instantly. Includes syntax highlighting, error detection, and a collapsible tree view — free, private, in-browser.
XML Formatter
Format and beautify XML online with proper indentation. Pretty print or minify XML and validate basic structure. Free XML formatter in your browser.
JSON to CSV Converter
Convert JSON arrays to CSV format online. Supports nested objects, custom delimiters, and CSV to JSON conversion. Free and private.
JSON to TypeScript Types
Convert JSON to TypeScript interfaces online. Infers types, nested objects, and arrays automatically. Free, private JSON-to-TS generator in your browser.
Cron Expression Generator
Build and decode cron expressions online. Get a plain-English description of any crontab schedule and a field-by-field breakdown. Free cron generator.
Regex Tester
Test and debug regular expressions online. See live matches, capture groups, and replace output. Free, private, instant.
Explore all Developer Tools.