---
title: "How to convert YAML to JSON | ToolSugar"
description: "Convert YAML to JSON, see how anchors, types and multiple documents are treated, and fix indentation errors by line and column."
canonical: https://toolsugar.com/blog/how-to-convert-yaml-to-json
image: https://toolsugar.com/og.png
---

# How to convert YAML to JSON and check your config

Updated 2026-11-09

To convert YAML to JSON, parse the YAML and write the same data with braces, brackets and quotes. YAML to JSON on ToolSugar does this in your browser using the yaml library. Paste your YAML and the indented JSON updates as you type, with errors shown by line and column.

[Open YAML to JSON](https://toolsugar.com/tools/yaml-to-json)

## Convert YAML to JSON in four steps

Paste text or open a .yaml or .yml file. Nothing needs a button press.

1. Paste YAML into the YAML box, or open a .yaml or .yml file.
2. Read the JSON in the result box on the right.
3. If a red message appears, go to the line and column it names.
4. Copy the JSON, or press Download to save data.json.

## Fix an indentation error

YAML marks structure with spaces, so one misplaced space can change the meaning or break the file. Tabs are not allowed. Every nested level must line up with its siblings.

Each message starts with the line and column where the parser stopped. That spot is where the structure stopped making sense, so check the line above it as well.

## Anchors, aliases and types

An anchor marks a value and an alias reuses it. JSON has no such feature, so each alias is expanded into a full copy of the anchored value.

Types follow the YAML core schema. Plain values such as 12, true and null become numbers, booleans and null. A quoted value, or anything that does not match, stays a string.

## One document per file

Only the first document of a file is supported. A file with several documents separated by --- is reported as an error. Split the file and convert each part on its own.

## Questions

### Why does "no" or "on" come out as a string?

The core schema only types true, false, null and number forms. Words such as yes, no and on stay strings, so check them if you wrote a config for an older parser.

### Can I check a GitHub Actions file this way?

Yes. The JSON shows exactly how the structure parses, which helps you spot a key at the wrong level. It does not check the file against the rules for that tool.

### Do YAML comments carry over?

No. JSON has no comments, so they are dropped from the output.

[Open YAML to JSON](https://toolsugar.com/tools/yaml-to-json)

## Related guides

- [How to convert JSON to YAML](https://toolsugar.com/blog/how-to-convert-json-to-yaml)
- [How to format JSON online](https://toolsugar.com/blog/how-to-format-json)
- [How to convert XML to JSON](https://toolsugar.com/blog/how-to-convert-xml-to-json)
- [How to convert CSV to JSON](https://toolsugar.com/blog/how-to-convert-csv-to-json)
