Code Tools

YAML to JSON

All tools

Paste YAML and get the equivalent JSON, with anchors, aliases and multi-line strings resolved.

How it works

Four simple steps

1

Paste YAML

Add a config file, OpenAPI spec or Compose file.

2

js-yaml loads

The parser library is fetched once from a CDN.

3

JSON appears

Types, anchors and block strings are resolved as you type.

4

Save out.json

Copy the JSON or download it.

YAML to JSON

About YAML to JSON

Your service reads JSON but the configuration is maintained in YAML, or you want to see exactly what a YAML file resolves to before some parser surprises you. Converting it shows every type and every expanded alias plainly.

The converter parses your YAML with js-yaml and prints the result as JSON with two-space indentation. Anchors and aliases are expanded into full copies, merge keys are applied, block scalars (| and >) become single strings with their newlines, and types are resolved by the YAML rules, so 8080 becomes a number, true a boolean, and quoted values stay strings. Output updates live and can be copied or downloaded as out.json. Parse errors appear under the panels with the line and column.

This is the fastest way to answer the question of what type a value really is. A version string like 1.10 without quotes becomes the number 1.1, a classic source of bugs that the JSON output makes obvious. Comments are dropped, since JSON has no place for them. Explore large results when you browse it as a tree, create a contract with the schema generator for JSON, or turn JSON back into YAML.

The js-yaml library is downloaded from jsDelivr the first time you convert; the YAML itself is parsed in this tab and is not uploaded.

Keyboard shortcut

Ctrl Enter - Run tool
FAQ

Frequently asked questions

See all FAQs

Answers for this tool. For site-wide help, open the FAQ hub.

Unquoted dates such as 2024-05-01 are read as YAML timestamps and become JavaScript dates, which JSON prints in full ISO form like 2024-05-01T00:00:00.000Z. Quote the value in the YAML to keep it as a plain string.

Yes. js-yaml applies merge keys, so the JSON shows the final merged map with the anchored values copied in and any local overrides applied.

Not in one go. The parser expects a single document, so split the file at each --- and convert the parts one at a time.

View more FAQs

Related tools

View all

HTML Formatter

Beautify and indent HTML markup.

Open

CSS Formatter

Format and pretty-print CSS.

Open

JS Formatter

Beautify JavaScript code.

Open

JSON Formatter

Beautify and validate JSON.

Open

Explore 321 free tools

Everything you need as a developer, marketer or creator - in one beautiful place.

Browse all tools