Skip to content
ToolMug

YAML to JSON Converter

Convert YAML config — Kubernetes manifests, Compose files, CI pipelines — into JSON for APIs and tools that only accept JSON. Anchors, aliases and multi-line strings are resolved, and syntax errors are reported with the line number.

Runs in your browser — nothing you enter is uploaded

YAML → JSON
Output (JSON)

How to use

  1. Paste YAML on the left, or click Load sample.
  2. Choose the JSON indentation. The result updates as you type.
  3. Fix any error shown — the message includes the line.
  4. Copy or download the JSON.

Options explained

Anchors and aliases
&name defines a reusable block and *name inserts it. In JSON the referenced content is copied in full.
Multi-line strings
| keeps line breaks, > folds lines into spaces. Both become ordinary JSON strings with \n where the line breaks are kept.
Duplicate keys
YAML forbids the same key twice in one mapping, but many parsers silently keep the last one. This converter reports it as an error so the mistake is not hidden.

Example

YAML:

defaults: &defaults
  retries: 3
  timeout: 30
production:
  <<: *defaults
  timeout: 60

JSON:

{
  "defaults": { "retries": 3, "timeout": 30 },
  "production": { "retries": 3, "timeout": 60 }
}

Frequently asked questions

Why do I get an error about indentation?

YAML uses indentation for structure, and tabs are not allowed. Make sure items in the same list or mapping start in the same column, using spaces only.

What happens to comments?

JSON has no comments, so they are dropped.

How are yes/no and on/off converted?

This converter follows YAML 1.2, where only true and false are booleans; yes, no, on and off stay strings. Older YAML 1.1 parsers (including PyYAML) treat them as booleans, so quote them if the file is shared.

Can it convert multiple documents separated by ---?

Yes. Each document becomes one element of a JSON array, in order.

Privacy

This tool runs entirely in your browser. Your files and text are processed on your device and are never uploaded to our servers.

Related tools