YAML ⇄ JSON converter and validator
Turn YAML configuration files into JSON for APIs and scripts, or JSON into clean, readable YAML for Kubernetes, Docker Compose, GitHub Actions and similar tools. The converter follows YAML 1.2, resolves anchors and aliases, rejects duplicate keys and points to the exact line and column of any syntax error. You can also reformat a YAML file with consistent indentation while keeping its comments.
Convert
Indentation
How to use the YAML to JSON Converter
- 1
Choose the direction
Pick YAML to JSON, JSON to YAML, or Format YAML.
- 2
Paste your data
The result updates as you type.
- 3
Fix any errors
If the input is invalid, the line and column of the problem are shown.
- 4
Copy or download
Copy the output or save it as a .json or .yaml file.
How YAML maps to JSON
JSON is a subset of YAML 1.2: mappings become objects, sequences become arrays, and plain scalars become strings, numbers, booleans or null. Anchors (&) and aliases (*) are expanded into copies.
YAML comments, styles and key order are not part of the data, so they are lost when converting to JSON. Formatting YAML keeps comments.
- key: value → {"key": "value"}
- - a\n- b → ["a", "b"]
When to use it
- Convert a Kubernetes or Compose file to JSON for a script or API.
- Turn a JSON API response into readable YAML.
- Find the exact indentation error that breaks a CI pipeline file.
Limits
- Multi-document YAML (separated by ---) converts the first document only.
- Custom YAML tags are read as plain values.
Privacy
Conversion happens entirely in your browser. Configuration files and secrets are never uploaded.
Frequently asked questions
Why does my YAML fail to parse?
The most common causes are mixed tabs and spaces, wrong indentation and an unclosed bracket or quote. The error shows the line and column to check.
Are comments kept?
Formatting YAML keeps comments. Converting to JSON drops them, because JSON has no comments.
Why are 'yes' and 'no' not converted to true and false?
This tool follows YAML 1.2, where only true and false are booleans. Older YAML 1.1 tools treated yes, no, on and off as booleans.
Are duplicate keys allowed?
No. Duplicate keys are an error in YAML 1.2, so the tool reports them instead of silently keeping one.
What happens to anchors and aliases?
They are expanded in the JSON output, so every alias becomes a full copy of the anchored value.
Is my file uploaded?
No. Everything runs in your browser.
Related tools
- JSON FormatterBeautify, validate, minify and sort JSON.
- XML Formatter & ValidatorBeautify or minify XML and check it is well-formed.
- Base64 Encoder & DecoderEncode and decode Base64 and Base64url, text or files.
- JSON Visual EditorEdit JSON as a tree: values, types, keys and order, with search and undo.
People also use
- JWT Generator & SignerCreate and sign JSON Web Tokens with HMAC, RSA or ECDSA keys, entirely in your browser.
- URL Encoder & DecoderPercent-encode or decode URLs and see their query parameters.
- CSV to JSON ConverterConvert CSV ⇄ JSON with correct quoting, types and nested data.
- UUID GeneratorBulk UUID v4 and v7 generator with a UUID inspector.
Last updated November 20, 2026 · How we build and test our tools