YAML to JSON Converter

Turn YAML into JSON, including anchors, block scalars and multi-document files.

YAML input
JSON output

About this tool

Convert YAML to JSON in your browser. Anchors and aliases are resolved, block scalars (the | and > forms) are read, and merge keys (<<) are expanded — the features that trip up naive converters.

A multi-document file (separated by ---) converts as a JSON array, in order, and the notes say how many documents were found.

Integers beyond 2⁵³−1 are emitted as JSON strings to keep every digit; YAML parse errors are reported with their line and column, not a stack trace.

How to use it

  1. Paste your YAML, or drop a .yaml / .yml file onto the input pane.
  2. The JSON appears on the right as you type. Multi-document files become an array.
  3. Copy or download. The notes state anything the conversion decided — document count, exact integers.

Worked example

The sample becomes a JSON object holding server, host, port and the labels list — block style resolved to JSON structure, indentation meaning preserved.

One mapping, faithfully read

Frequently asked questions

What YAML features are supported?
The 1.2 core schema: mappings, sequences, block and flow styles, quoted and bare scalars, block scalars, comments, anchors and aliases, merge keys, and multi-document files. Tags beyond the core schema come through as their resolved values.
Why are my timestamps strings?
JSON has no date type. The 1.2 core schema reads 2020-01-01 as a string, which is what JSON can hold. If your consumer wants ISO strings, they already are.
How are anchors handled?
Anchors (&base) and aliases (*base) are resolved to the values they name, so the JSON you get is what a YAML reader would hand you. Cycles — an anchor containing itself — cannot become JSON and are reported.
What does the note about 2⁵³ mean?
An integer larger than 9,007,199,254,740,991 cannot be held exactly by a JavaScript number. Emitting it as a JSON number would silently round it, so it becomes a string with every digit. Consumers that need numbers can parse the string themselves.
Is my data uploaded anywhere?
No. Conversion is local; a dropped file is read in the tab and never leaves it.