How to use the YAML to JSON
- 1
Paste YAML into the left pane, drop a .yaml or .yml file onto it, or press Sample. The JSON appears on the right as you type.
- 2
Choose 2 or 4 space indentation, or tick Minify for a single-line result.
- 3
If the status line reports an indentation or syntax error, the exact spot is underlined in the editor. Fix it and the output updates.
- 4
Press the swap button to convert JSON back to YAML.
- 5
Copy the result or download it as a .json file.
Features
- Converts YAML 1.2 to JSON and back, live as you type
- Pinpoints indentation and syntax errors with line and column, underlined in the editor
- Resolves anchors, aliases and merge keys so the JSON is fully expanded
- Multi-document streams separated by --- become a JSON array
- Pretty output with 2 or 4 spaces, or minified on one line
- Detects the format of a pasted file and switches direction for you
- Core schema typing: numbers, booleans and null are converted, dates stay strings
- Runs entirely in your browser; nothing is uploaded
YAML in, JSON out
YAML is pleasant to write and easy to get wrong. A single stray space changes the structure, and the error messages from most tools point somewhere vague. Converting to JSON is a reliable way to see what a YAML file really says: the braces and brackets make nesting explicit, and the conversion fails loudly, at a precise line and column, when the YAML is malformed.
That makes this page useful as a validator as much as a converter. Paste a Kubernetes manifest, a GitHub Actions workflow or a Docker Compose file and you either get clean JSON or a pointer to the exact mistake.
What the conversion keeps and drops
Comments are dropped, because JSON has nowhere to put them. Anchors and aliases are expanded, merge keys are applied, and multi-line block scalars become ordinary strings with their line breaks preserved. Types follow the YAML 1.2 core schema, so plain numbers, booleans and nulls convert and everything else, including dates and the words yes and no, stays a string.
Related tasks
Use JSON to YAML for the opposite direction with its own options, and the JSON Formatter to reformat or sort the result.
Frequently asked questions
Why does my YAML fail to convert?
What happens to anchors, aliases and merge keys?
How are multiple documents handled?
Will 1.0, yes or 2024-01-31 change type?
Can I convert JSON to YAML on this page too?
Is my data uploaded anywhere?
Last updated .