YAML → JSON

YAML to JSON

YAML to JSON expands mappings, sequences and aliases into JSON values. Multiple --- documents become a JSON array in their original order.

Drop a file or paste below
Conversion options

Ready

YAML anchors and merged mappings

An anchor names an existing value and an alias references it. JSON has no alias syntax, so referenced values are expanded into the resulting objects or arrays. Merge keys are accepted for configuration files that use <<. A cyclic alias has no finite JSON equivalent and produces an error instead of an incomplete object.

Multiple documents and JSON arrays

A single YAML document converts to its own JSON value. Two or more documents produce an outer array, preserving their order and any inner arrays. Comments and anchor names describe the source text and do not become JSON fields. Duplicate mapping keys are reported rather than silently overwriting earlier values.

YAML scalar types and JSON limits

YAML 1.2 core types distinguish strings, numbers, booleans and null. A plain yes remains a string, while true is a boolean. Infinity, NaN, cycles and object-valued mapping keys do not have matching JSON representations here. Parse errors include the source location when the parser provides it, making indentation mistakes easier to find.

Format references

YAML 1.2.2 · JSON format

File content is read and converted in the browser. Conversion does not upload the source to a server.

Frequently asked questions

Are anchors preserved in JSON?

The referenced values are expanded; anchor names are not stored.

How are several documents converted?

They become a JSON array in source order.