YAML to JSON Converter
YAML to JSON Converter takes a single YAML document that you paste and produces strict JSON representing the same data, entirely in your browser.
Converts supported YAML data to strict JSON locally in your browser. YAML 1.2 semantics are used, so true/false are booleans while yes/no/on/off stay strings and an unquoted date stays a string. JSON cannot represent every YAML feature: comments are not preserved, and unsupported YAML-specific types — custom tags, !!binary, !!timestamp, non-string mapping keys, integers too large for a JSON number, Infinity/NaN, and cyclic aliases — are rejected rather than silently changed. Acyclic anchors and aliases are expanded into duplicated values, and duplicate mapping keys are rejected. This is different from JSON to YAML, which converts the other direction, and from the JSON Formatter, which formats JSON.
How to use it
- Paste a single YAML document into the input box
- Choose the JSON indentation: 2 or 4 spaces, or compact
- Click Convert to JSON
- Review the JSON output and character counts, then copy the JSON
YAML 1.2 semantics are used: true and false are booleans, null and ~ are null, but yes, no, on, and off stay strings, and an unquoted date such as 2026-08-31 stays a string rather than becoming a date object. Mappings, sequences, and top-level primitives are all accepted. JSON cannot represent every YAML feature, so several things are rejected with a clear message rather than silently changed: multiple YAML documents in one input, duplicate mapping keys, non-string mapping keys (a bare 1: is refused to avoid a 1 versus "1" clash), custom tags, !!binary, !!timestamp, integers too large to be a safe JSON number, and Infinity or NaN. Acyclic anchors and aliases are expanded into duplicated values; a cyclic alias, or an alias-amplification attack, is stopped. Comments are not preserved, because JSON has no comments. You can choose 2- or 4-space indentation or compact output, and keys are not sorted. Nothing is uploaded or stored. This is different from JSON to YAML, which converts the other direction, and from the JSON Formatter, which only formats JSON.
FAQ
Mappings, sequences, strings, finite numbers, booleans, and null, plus a top-level primitive on its own. Anchors and aliases are expanded, provided the resulting structure is not circular.
No. JSON has no comments, so any comments in the YAML are dropped. The converter does not attempt a syntax-level round trip, only a data-level one.
An acyclic alias is expanded, so the referenced value appears wherever the alias is used. A cyclic alias, or an input that expands too many aliases, is rejected with a message.
JSON cannot represent them. Custom tags, !!binary, !!timestamp, non-string keys, Infinity, NaN, and integers outside the safe JavaScript number range are refused rather than rounded or reshaped.
No. The YAML is parsed and serialized to JSON in your browser. The input, the JSON output, and your options are never sent to a server or saved.