YAML JSON Converter
Convert YAML to JSON and JSON to YAML locally with clear parse errors.
Documents are parsed locally in your browser. Nothing is uploaded.
YAML and JSON converter
YAML
Source or resultJSON
Two-space indentationConvert in either direction. Parser errors report the line where the document stopped being valid.
How the conversion works
YAML is read with js-yaml, a JavaScript parser that is bundled with this page, and written back with the same library. JSON uses the parser built into every browser. Both directions go through a real data structure rather than a text substitution, so quoting, escaping, numbers, booleans, and nested lists survive the round trip.
Why the JSON is indented by two spaces
Two spaces is the most common convention in configuration files and produces diffs that stay readable in code review. The JSON output is always pretty-printed; minified JSON is not offered because the goal here is a readable document, not the smallest possible payload.
What YAML can express that JSON cannot
YAML supports comments, anchors, aliases, and tags. Comments are dropped during conversion because the converted document is a data structure, not the original text. Aliases are expanded into their values, so a shared value becomes a repeated value. A recursive structure that refers to itself cannot be written as JSON and is reported as an error instead of producing an endless document.
Frequently asked questions
Does it handle multi-document YAML files?
No. A file with several documents separated by --- is rejected with an error naming the line. Split it into single documents, or convert each document separately.
How are dates and timestamps handled?
Unquoted values such as 2024-05-01 are kept as plain strings by this parser build, so they survive the round trip unchanged. Quote a value when you need to be sure it stays text.
Is the document sent anywhere?
No. Both parsers run in this tab. Nothing is uploaded, logged, or saved between visits.