Skip to content
JSON Runs offline

YAML to JSON Converter

Turn YAML configuration into JSON, anchors and all.

Input

0 chars

Output

0 chars
Ctrl

Questions

Does this handle anchors, aliases and merge keys?

Yes. An anchor (&name) is recorded, an alias (*name) is expanded where it appears, and a merge key (<<: *name) pulls the anchored mapping in as defaults, with any key written explicitly on the mapping winning. That is what makes docker-compose.yml and .gitlab-ci.yml files convert correctly, since both lean on merge keys to share blocks between services or jobs.

Why did my value "no" stay a string instead of becoming false?

Because this converter follows YAML 1.2, where only true and false are booleans. Under the older YAML 1.1 rules, yes, no, on and off were also booleans, which is how the Norwegian country code NO became false in countless config files. YAML 1.2 fixed that, and so does this tool.

What is not supported?

Explicit tags (!!binary, !Custom), complex mapping keys (? and :), and the %YAML and %TAG directives. Each is reported as a named error naming the line, rather than being parsed into something that looks plausible but is wrong. Tabs used for indentation are rejected the same way, since YAML forbids them and the mistake is easy to miss.

What happens with a file holding several documents?

A stream separated by --- markers converts to a JSON array with one element per document, in order. A single document converts to that document alone rather than a one-element array.

Is there a size limit?

Two megabytes, and 500,000 nodes after aliases are expanded. The node cap matters because a few lines of nested aliases can expand into an enormous structure - the classic billion-laughs document - which would otherwise hang the tab. Both limits report a named error rather than truncating quietly.

Open JSON Formatter

JSON Formatter

Format, indent and inspect JSON with clear error reporting.

JSON