My Tool Studio
Developer Tools·2 min read

YAML to JSON: See What Your Config Contains

YAML is easy to write and easy to get subtly wrong. The YAML to JSON Converter parses it with js-yaml, a YAML 1.2 parser, and returns pretty-printed JSON with 2-space indentation. Mistakes are reported with a line and column instead of being guessed at. It runs in your browser, so configs with secrets stay on your device.

.yaml.jsonYAML → JSON

What the converter does

Config in, data out.

Paste YAML, drop a file or load one from a URL, and the JSON appears as you type. A single document becomes one JSON value. For a file with several documents separated by ---, the Several documents menu gives a JSON array with one item per document, JSON Lines with one document per line, or just the first document.

Anchors, aliases and << merge keys are expanded, because JSON has no references. That makes the tool useful for seeing what a Kubernetes manifest, Helm values file or CI config really contains once every alias is resolved.

Errors that point to the line

Strict parsing is a feature.

Bad indentation, tabs used for indenting and duplicate keys are highlighted on their line, with the column, a plain-English reason and a snippet of the surrounding lines. Go to line jumps there. The YAML spec does not allow tabs for indentation, so replace leading tabs with spaces, usually 2 per level.

A repeated key usually means a copy and paste mistake, so it is an error by default. If you know the file relies on the last value winning, tick Allow duplicate keys.

Why a value turned into a number or a date

YAML types unquoted values.

Unquoted values are typed: 10 becomes a number, true becomes a boolean, and null or ~ becomes null. With the default schema, an unquoted date like 2024-01-15 is read as a timestamp and written as an ISO string.

The Schema menu changes that. The YAML 1.2 core schema stops date conversion, and Failsafe keeps every value as a string. Quoting a value in the YAML also keeps it as plain text. Comments are dropped, since JSON has no comment syntax.

Going from JSON back to YAML

The reverse direction.

The JSON to YAML Converter writes 2-space block YAML as you type and quotes strings that would otherwise change type. For work on the command line, yq -o=json file.yaml does the same conversion.

Keep in mind that this tool checks YAML syntax, not whether the fields are valid for Kubernetes or Docker Compose.

Try it now

Open YAML to JSON Converter

The tool is one click away. No sign up, no upload, no payment.

Open YAML to JSON Converter