YAML to JSON
Convert YAML (including multi-document files) to formatted JSON, with line numbers on syntax errors.
Paste or drop
Paste text below, or drop a file instead.
Choose an output
Convert YAML (including multi-document files) to formatted JSON, with line numbers on syntax errors.
Fine-tune
Optional — sensible defaults are already set.
About YAML to JSON
This converter parses YAML and outputs formatted JSON, with your choice of 2 spaces, 4 spaces or tabs. Files with several documents separated by --- become a JSON array, and syntax errors are reported with the line and column where parsing failed.
When it helps
- Converting a Kubernetes manifest or Helm values file to JSON for jq or an API call.
- Checking how a tricky YAML file is actually interpreted, for example whether a value became a string or a number.
- Turning an OpenAPI YAML spec into JSON for tools that only accept JSON.
- Debugging indentation errors in CI configuration files by getting the exact error location.
Tips
- Anchors and aliases (&default and *default) are expanded, so the JSON shows the fully resolved values.
- Watch for unquoted values: version: 1.10 becomes the number 1.1, and a leading-zero value may not be read as you expect. Quote them in the YAML to keep them as strings.
- Comments are dropped, since JSON cannot represent them.
Good to know
Quick answers about yaml to json in your browser.
Each document separated by --- becomes one element of a top-level JSON array. A file with a single document produces a plain object or value, not an array.
The parser follows YAML 1.2 by default, where only true and false are booleans. Words like yes, no, on and off stay strings, unlike older YAML 1.1 parsers.
Yes. There is no sign-up, no watermark and no limit on how many files you process.
No. Files are read and processed locally in your browser, so they never leave your device.
Related tools
Part of the JSON, YAML & XML Tools collection.