YAML to JSON Converter
Paste YAML on the left, get JSON on the right. Runs entirely in your browser — no upload, no signup.
- Paste your YAML into the left textarea.
- Click "Convert to JSON". Output appears on the right.
- Copy the result, or click Download to save as data.json.
- If the conversion fails, the error message points at the offending line.
What does it do?
Converts YAML 1.2 documents to equivalent JSON. Mappings become objects, sequences become arrays, scalars are typed as numbers, booleans, nulls, or strings according to YAML rules. Anchors and aliases are resolved during conversion. Multi-document streams (separated by `---`) are flattened to an array of documents.
Example
YAML input:
name: Ada
tags:
- math
- logic
active: true JSON output:
{
"name": "Ada",
"tags": [
"math",
"logic"
],
"active": true
} Common YAML errors and how to fix them
YAML is whitespace-sensitive, which is the source of most "failed to parse" messages. The parser points at the line and column of the failure — these are the patterns to look for.
- Tabs instead of spaces. YAML 1.2 forbids tabs for indentation. Replace every tab with spaces — most editors have a "convert tabs to spaces" command.
- Mixed indent levels. A child indented 2 spaces under a sibling indented 4 spaces will fail. Pick one indent width (usually 2 spaces) and use it consistently throughout the document.
- Strings that look like booleans. In YAML 1.1, `yes`, `no`, `on`, `off` parse as booleans — surprising in country codes (the "NO" trap) and version strings. Quote the value: `country: "NO"`. js-yaml defaults to YAML 1.2 where this is fixed, but real-world inputs still hit the issue.
- Unquoted special characters. Values starting with `- `, `:`, `?`, `&`, `*`, `!`, `|`, `>`, `\'`, `"`, `%`, `@`, `` ` `` need quoting. The safest pattern: quote any string with punctuation.
- Unterminated quote. A missing closing `"` or `\'` makes the parser treat the rest of the file as part of the string until the next quote — usually producing a confusing line number far from the actual mistake.
- Anchor / alias mismatch. Aliases (`*name`) referencing an undefined anchor (`&name`) raise a parse error. Check that every alias has a matching anchor declared earlier in the document.
Frequently asked questions
Does this support YAML 1.1 quirks like the "Norway problem"?
No — and that is intentional. We use js-yaml in YAML 1.2 mode, where unquoted `NO` parses as the string "NO" rather than the boolean false. If you have inputs that depend on YAML 1.1 booleans, quote them explicitly before pasting. Mixing the two specs in one tool would silently mistranslate your data.
What happens to YAML anchors and aliases?
They are resolved during conversion. The resulting JSON contains the duplicated values as plain data — anchors do not survive into JSON because JSON has no equivalent reference syntax. If you need the references preserved, JSON is not the right target format.
Can I convert multi-document YAML files?
Yes. YAML files containing multiple documents separated by `---` are converted to a JSON array, with each document becoming one element of the array. If your file is a single document, it is converted to a single JSON object or value at the top level.
Why does my date string come out as ISO format?
YAML has a native timestamp type (`2025-12-31`). The parser reads it as a JavaScript Date, which serializes to JSON as an ISO 8601 string. To keep the original literal text, quote the value in your YAML: `release: "2025-12-31"`.
Is this safe for sensitive YAML configs?
Yes. Everything runs in your browser — your input is parsed and converted by the JavaScript on this page, not sent to any server. There are no logs, no analytics on the input itself, no retention. Verify in your browser developer tools: no network requests fire when you click Convert.
How big a YAML file can it handle?
Up to your browser memory limit, but the textarea UI starts to feel sluggish above ~10 MB of YAML. For larger inputs, convert in chunks or use the same library (js-yaml) on the command line.