Paste YAML and valid JSON appears instantly, pretty-printed or minified. If the YAML has a mistake, the faulty line is highlighted and the message tells you what's wrong. Everything runs in your browser.
Last updated:
1
JSON output
Converts automatically as you type. Comments are not kept because JSON has no comments.
Advertisement
Advertisement
How to use the YAML to JSON Converter
Paste your YAML into the left box, upload a .yaml or .yml file, or click Sample.
Fix any errors. The status bar shows the line and column of the first problem and the line is highlighted in red. Click Go to error to jump there.
Choose Pretty or Minified JSON and the indentation you prefer.
Several documents? Files with --- separators are converted to a JSON array with one item per document.
Copy or download the JSON.
How YAML values become JSON
YAML
JSON
Notes
name: web
{"name": "web"}
Plain scalars are strings unless they look like a number, boolean or null
port: 8080
{"port": 8080}
Numbers stay numbers; quote them ("8080") to keep a string
debug: false
{"debug": false}
YAML 1.2 booleans are only true and false
value: ~ or value:
{"value": null}
~, null and an empty value are all null
- a - b
["a", "b"]
Block sequence; [a, b] flow style works too
text: | block
"line 1\nline 2\n"
Literal block keeps line breaks; > folds them into spaces
date: 2026-10-19
"2026-10-19T00:00:00.000Z"
Unquoted dates are timestamps; quote them to keep the original text
<<: *defaults
Merged keys
Anchors, aliases and merge keys are expanded
Fixing common YAML errors
Bad indentation: sibling keys must start in exactly the same column and children must be indented further than their parent. Use spaces only; this editor inserts two spaces when you press Tab.
Missing space after the colon:key:value is read as one string. Write key: value.
Special characters: values that start with @, `, *, &, !, %, { or [, or that contain : or #, should be quoted.
Duplicate keys: a key may appear only once in the same mapping.
Mixed list and map: an item cannot be both - item and key: value at the same indentation level.
Paste the YAML into the input box. It is parsed and converted to JSON immediately: mappings become objects, sequences become arrays, and scalars become strings, numbers, booleans or null.
Why do I get a 'bad indentation' error?
YAML uses indentation to show structure, so items at the same level must start in the same column, and nested items must be indented further than their parent. Tabs are not allowed for indentation; use spaces.
What happens to YAML comments?
They are removed. JSON has no comment syntax, so comments cannot be carried over.
How are multiple YAML documents converted?
A file with several documents separated by --- lines, such as a set of Kubernetes manifests, becomes a JSON array where each element is one document. A file with a single document becomes a single JSON value.
Are anchors and aliases supported?
Yes. Anchors (&name), aliases (*name) and merge keys (<<: *name) are resolved, so the JSON contains the full, expanded data.
Why did yes or on stay as text?
This converter follows YAML 1.2, where only true and false are booleans. Older YAML 1.1 parsers also read yes, no, on and off as booleans; quote values or use true/false to be safe across tools.
Is my YAML uploaded anywhere?
No. Parsing uses the open-source js-yaml library running locally in your browser, so configuration files and secrets never leave your device.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.