Skip to content

Convert YAML to JSON safely

Paste one YAML document and produce valid, indented JSON. The converter uses the YAML 2.9 parser and rejects ambiguous or non-JSON structures instead of silently changing them.

YAML input

Processed in your browser.

One document, up to 200,000 characters. Data stays in this browser.

Result

How to convert YAML to JSON

Convert a document

  1. Paste a complete YAML document.
  2. Choose two- or four-space JSON indentation.
  3. Select Convert to JSON and fix any error with its line and column.
  4. Review the result, then copy it or download yaml-output.json.

Conversion and safety rules

Mappings become JSON objects, sequences become arrays, and ordinary strings, finite numbers, booleans and null keep their JSON equivalents.

Duplicate mapping keys stop conversion instead of overwriting an earlier value. Multiple YAML documents are rejected because one JSON result cannot preserve document boundaries.

Explicit tags and aliases are rejected. That prevents application-specific object construction, shared references and cycles that JSON cannot represent. Safe integers are emitted as JSON numbers; oversized integers, NaN and infinity are rejected.

Examples

name: mouse active: true items: - cheese - crackers becomes an object containing a Boolean and a JSON array.

A second name key, a --- second document, !!custom tags or *alias references produce a specific error rather than partial output.

Limits

  • The input limit is measured as stored UTF-16 characters before parsing. Output is produced only after the whole document passes validation.
  • This page does not convert JSON back to YAML, fetch URLs, resolve custom schemas or preserve YAML comments and presentation style.

YAML to JSON FAQ

Why reject aliases?

JSON has no shared-reference or alias syntax. Expanding aliases can also create very large or circular structures, so this focused converter refuses them.

Why reject duplicate keys?

JSON consumers disagree about which duplicate wins. Stopping avoids a silent change of meaning.

Are dates converted automatically?

No custom date conversion is promised. Ordinary core-schema strings remain strings, and explicit tags are rejected.

Is the YAML uploaded?

No. Parsing, copying and file creation happen in this browser.