---
title: "How to convert JSON to YAML | ToolSugar"
description: "Convert JSON to YAML for configs and CI files. See how quoting, indentation and comments work, and how to fix errors in the source JSON."
canonical: https://toolsugar.com/blog/how-to-convert-json-to-yaml
image: https://toolsugar.com/og.png
---

# How to convert JSON to YAML for config files

Updated 2026-11-09

To convert JSON to YAML, drop the braces and quotes and show structure with indentation. JSON to YAML on ToolSugar does this in your browser with the yaml library. Paste JSON and the YAML appears at once, indented two spaces, without long lines being folded.

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

## Convert JSON to YAML in four steps

The conversion runs as you type, so you can edit the JSON and watch the YAML change.

1. Paste JSON into the JSON box, or open a .json file.
2. Read the YAML in the result box on the right.
3. Fix any error shown, using the line and column it reports.
4. Copy the YAML, or press Download to save data.yaml.

## What the YAML looks like

Objects become key lines, lists become lines that start with a dash, and each level moves in by two spaces. Long strings stay on one line.

The output converts back to the same data with the YAML to JSON tool, so you can use it to check a round trip.

## Strings that look like numbers

YAML reads a bare 123 as a number and a bare true as a boolean. If your JSON holds the strings "123" or "true", the converter quotes them in the YAML. Without the quotes, a later parser would change their type.

That quoting is deliberate, so do not strip it by hand unless you want the type to change.

## What happens to comments

JSON has no comments, so the YAML starts without any. Add notes with a # at the start of a line after you convert.

Tabs are not allowed for YAML indentation, so keep to spaces when you edit the result.

## Questions

### What if my JSON has a syntax error?

The tool reports the line and column of the first error and shows no YAML until you fix it. A trailing comma or single quotes are the usual causes.

### Can I use the result in Kubernetes or CI files?

The output is plain YAML with two space indentation, which those tools read. You still need the right keys for the tool, since the converter only changes the format.

### Is the JSON order kept?

Yes, with one exception. A key that is a plain whole number, such as "2", moves to the front of its object, because JavaScript orders object keys that way.

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

## Related guides

- [How to convert YAML to JSON](https://toolsugar.com/blog/how-to-convert-yaml-to-json)
- [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 JSON to CSV](https://toolsugar.com/blog/how-to-convert-json-to-csv)
