Skip to content
Language:en

YAML to JSON converter

Convert YAML configuration files to JSON and JSON back to YAML, with clear error messages.

Convert
Indentation

Runs entirely in your browser. Your files never leave your device.

About this tool

Docker Compose, Kubernetes manifests, GitHub Actions workflows, OpenAPI specs: modern configuration is written in YAML, while scripts and APIs often expect JSON. Paste YAML to get the equivalent JSON, nicely indented, or switch direction to turn JSON into clean, readable YAML.

The converter follows the YAML 1.2 specification, with anchors and aliases, multi-line strings and several documents separated by three dashes, which become a JSON array. When the YAML is invalid, for instance because of an indentation mistake or a tab, the error message points to the problem so you can fix it quickly. Configuration files often hold secrets, and here they never leave your browser.

How it works

  1. Choose YAML → JSON or JSON → YAML.
  2. Paste your file.
  3. Choose an indentation of 2 or 4 spaces.
  4. Copy or download the result.

Conversion uses the open-source yaml library, loaded only when you use the tool. Comments in YAML have no JSON equivalent and are dropped.

Worked example

A Docker Compose excerpt, services: / web: / image: nginx:1.27 / ports: ["8080:80"], becomes {"services": {"web": {"image": "nginx:1.27", "ports": ["8080:80"]}}}.

If a line is indented with a tab, the error message points to that line: YAML only accepts spaces for indentation.

Good to know

  • Quote values such as NO, yes or 08: some YAML 1.1 tools turn them into booleans or octal numbers.
  • Every JSON document is also valid YAML, so JSON can be pasted into most YAML configuration files.
  • Anchors and aliases are expanded in the JSON output, which can make it much longer.

Frequently asked questions

Why does my YAML give an error?
The most common causes are tabs instead of spaces, inconsistent indentation and a missing space after a colon. The message gives the line and column.
Is JSON valid YAML?
Yes, YAML 1.2 is a superset of JSON, so any JSON file can be read as YAML. The reverse is not true.
Is it safe to paste a file with passwords?
The conversion happens entirely in your browser and nothing is sent. Still, rotate any secret that has been shared somewhere it should not be.