DevToolPal
EN

YAML to JSON Converter

Convert YAML to JSON and JSON to YAML, with anchors, multi-document files and exact error positions.

Runs locally, never uploaded

Options

Direction
Indent

Input

0 chars · 0 B

Output

0 chars · 0 B

What it does

This tool converts YAML to JSON and JSON to YAML. YAML is popular for configuration (Kubernetes, Docker Compose, GitHub Actions, OpenAPI specs) because it is easy to read and write by hand. JSON is what most programs, APIs and browsers consume. Converting between them lets you validate a config, feed it to a script, or turn an API response into a readable config file.

How to use

  1. Paste YAML into the Input box, drop a .yaml or .yml file on it, or click Sample.
  2. The JSON appears on the right as you type. Choose 2 or 4 spaces of indentation.
  3. Switch Direction to JSON → YAML to go the other way. Long strings are never wrapped, so values stay on one line.
  4. Copy or download the result.

If the YAML is invalid, the error shows the line and column, and clicking it moves the cursor there. Common mistakes are inconsistent indentation, a tab used for indentation, a missing space after a colon, and duplicate keys in the same mapping.

Example

name: devtools
ports:
  - 80
  - 443
database:
  host: db.internal

becomes

{
  "name": "devtools",
  "ports": [80, 443],
  "database": { "host": "db.internal" }
}

Things to know about YAML

YAML guesses types from plain values: 3 is a number, true is a boolean, null and ~ mean null, and 1.2.0 stays a string because it is not a valid number. Wrap a value in quotes when you want it to stay text, for example a ZIP code like "01234". Anchors (&name) and aliases (*name) let you reuse a block; the converter expands them into full copies in the JSON. Block scalars written with | keep line breaks, while > folds lines into one paragraph.

FAQ

› Is my YAML sent to a server?

No. The YAML parser runs in your browser, so Kubernetes manifests, CI pipelines and config files with secrets never leave your device.

› Which YAML version is supported?

YAML 1.2, the current standard, including anchors and aliases, block and flow collections, multi-line strings and comments.

› What happens with a file that contains several documents?

Documents separated by `---` are converted into a JSON array with one element per document. An empty document after a trailing `---` is ignored.

› Are comments kept when converting JSON to YAML?

JSON has no comments, so there is nothing to keep. When converting YAML to JSON, comments are dropped because JSON cannot represent them.