Skip to main content
ToolsHub

YAML ↔ JSON Converter

Paste YAML or JSON and convert between the two formats instantly. Syntax errors are reported inline so you can fix config files fast — all client-side.

Updated

Files never leave your browser

Converted output will appear here

Paste YAML on the left to convert it to JSON.

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.

  1. Paste your YAML content into the input panel, or paste JSON to convert in the reverse direction.
  2. The tool automatically detects the input format — look for the "Detected: YAML" or "Detected: JSON" indicator.
  3. Click Convert to YAML or Convert to JSON depending on your target.
  4. If the input contains syntax errors, an inline error message shows the line number and description.
  5. Review the output — YAML uses indentation for structure while JSON uses braces and quotes.
  6. 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.

YAML vs JSON syntax comparison
ConceptYAMLJSON
Object / mapkey: value (indented){"key": "value"}
Array / sequence- item (indented)["item"]
Stringno quotes needed (usually)"must be double-quoted"
Booleantrue / false (also yes/no in 1.1)true / false
Nullnull or ~ or emptynull
Multiline string| (literal) or > (folded)Escape \n in one-liner
Comments# commentNot supported
Anchors & aliases&anchor / *aliasNot 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

Free · No spam

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

Explore all Developer Tools.