AAllMyToolsa pocketful of little tools
YAML

YAML to JSON

DevNo. 93 / 93

Convert YAML to JSON and back, with the line and column of the error when it fails. Docker, Actions and Kubernetes configs never leave your browser.

the config file and the API speak different dialects.

work surface

Math, not advice — results are indicative.Read the disclaimer.

most-used utilities

A Kubernetes manifest

Turn a values.yaml into JSON to inspect it, without uploading the file anywhere.

GitHub Actions config

Check a workflow before pushing: one bad indentation and the run fails before the first step.

An API payload

Convert a JSON example into YAML for a config file, with the nesting preserved.

pro tips

If a YAML fails on a line that looks correct, check the line above: tabs and mixed indentation usually report one line late.

JSON does not allow comments, and YAML does. Converting YAML to JSON drops them silently, so keep the YAML if the comments carry information.

Anchors and aliases are expanded. A YAML file that is short because of anchors becomes a longer JSON file, which is expected.

what it does

Paste a YAML file and get the JSON equivalent, or switch direction and turn JSON into YAML. The conversion is structural, not textual: comments are dropped, anchors are resolved and the result is a clean document.

Errors are the useful part. A broken YAML usually breaks on an indentation that looks fine, so the tool reports the line and column js-yaml complains about instead of a generic "invalid". For JSON, the parser position is converted into a line and column too.

Both directions run in the browser. That matters more than it sounds: Kubernetes manifests, CI configs and application settings routinely contain tokens, internal hostnames and credentials. Pasting them into a converter on a server is a habit worth losing.

The output follows the conventions: two-space indentation for YAML, two-space JSON, keys in their original order, and no attempt to sort or reformat names. What you paste is the order you get.

quick answers

Is my config uploaded?

No. The parsing and the conversion happen in the browser tab. Nothing is sent to a server, which is why the tool keeps working with the network off.

Why did my comments disappear?

JSON has no comment syntax, so converting YAML to JSON drops them. The conversion is structural: only data survives.

Does it support multiple YAML documents?

It reads the first document. Files separated by --- with several documents are common in Kubernetes; split them first if you need each one separately.

Are anchors and aliases kept?

They are resolved into their values. The JSON is equivalent, but it will be longer than the YAML it came from.