YAML to JSON Converter Online - Free & Private
Paste YAML or drop a .yml file and get formatted JSON. Comments are dropped, anchors and aliases are expanded, and a file with several documents becomes a JSON array. If the YAML is invalid, you see the line and column of the problem.
How to convert YAML to JSON
- Paste YAML into the left editor, or open or drop a .yaml or .yml file.
- Formatted JSON appears on the right. A YAML syntax error is marked in the editor with its line number and a short reason, such as bad indentation.
- Browse the result in tree view, copy it, or download it as a .json file.
What happens to YAML features
- Comments are removed, because JSON has no comments.
- Anchors and aliases (
&defaultsand*defaults) and merge keys (<<: *defaults) are expanded into full copies of the values. - Several documents separated by
---become a JSON array with one item per document, which is how a multi-resource Kubernetes file is usually shaped. - Block scalars (
|and>) become ordinary strings with their line breaks kept or folded as YAML defines. - Types follow the YAML 1.2 core schema:
true,false, numbers andnullare typed values, and dates stay as strings.
When to use it
Converting YAML to JSON is useful when an API, a JSON Schema validator or a script expects JSON, when you want to check exactly how a YAML file is parsed (indentation mistakes become obvious in the tree view), or when you need to paste a config into a tool that only accepts JSON.
Example
defaults: &defaults retries: 3 api: <<: *defaults url: https://example.com
becomes {"defaults":{"retries":3},"api":{"retries":3,"url":"https://example.com"}}.
The JSON to YAML converter does the reverse.
Private by design
Your YAML is parsed in your browser with the open-source js-yaml library and is never uploaded.