Free YAML to JSON Converter
Turn YAML configuration into JSON you can use in code, APIs and tests. Paste YAML, check the JSON result, and copy it without creating an account.
JSON output
Your input never leaves this device — the conversion runs entirely in your browser.
What YAML to JSON conversion does
YAML and JSON describe the same kinds of data: mappings of named fields, sequences of values, strings, numbers, booleans and null values. YAML shows structure with indentation, while JSON shows it with braces, brackets, commas and quoted keys. Conversion keeps the data and rewrites it in JSON notation.
That rewrite is useful when a program, API or test expects JSON but the source material lives in YAML, as it often does for configuration files. Once the data is JSON, it can be pasted into code, sent in a request body, or checked with JSON tools. The converter uses the js-yaml parser: anchors and aliases are resolved, but the input must be a single document — multi-document files (with --- separators) and custom tags are not supported and will be reported as errors.
Conversion runs entirely in your browser. Nothing you paste is uploaded or stored, and the result is produced on your own device. If the YAML has an error, such as inconsistent indentation, the error must be fixed in the YAML before JSON can be produced.
How to convert YAML to JSON
Follow these steps to convert a YAML document into JSON:
- Paste your YAML into the input area, or type a short document directly.
- Read the JSON result in the output area and scan it for the fields you expect.
- Copy the JSON and paste it where it is needed, such as a code file, a test fixture or a request body.
- Check the JSON in the program that will use it. The destination program decides whether field names and types are acceptable.
- Keep the original YAML file unchanged until the JSON version has been tested, so you can compare the two if a value looks wrong.
If an error names a line, go to that line in the YAML and check indentation first. Most YAML errors come from a line that is indented by the wrong amount or mixed with tabs.
Worked example: server settings
This example shows a small server setting in YAML and the JSON it produces. The nested mapping becomes a nested object, and the sequence becomes an array.
server: host: example.com port: 443 secure: true tags: - web - public
{
"server": {
"host": "example.com",
"port": 443,
"secure": true
},
"tags": ["web", "public"]
}Field order is preserved, and the values keep their types: 443 stays a number and true stays a boolean. The YAML comments, if any were present, do not appear in the JSON, because JSON has no comment syntax.
Every level of nesting follows the same rule, so a deeply nested YAML file becomes a deeply nested JSON object with the same shape.
Rules, types and edge cases
Types follow the YAML text. A quoted value is always a string, while an unquoted value is read by its form: digits become a number, true and false become booleans, and null, a tilde, or an empty value become null. That is why quoting matters: write "123" with quotes when you need the characters 1, 2 and 3 as text, not the number 123.
Keys become JSON object keys, so keep them as plain strings for the cleanest result. Anchors and aliases are resolved during parsing, so an alias appears in the JSON as the value it points to, repeated wherever it is used. Multi-document files and custom tags are not supported: paste one document at a time, and replace custom tags with plain values before converting.
Duplicate keys are an error. If the same key appears twice at the same level, parsing stops and the duplication must be removed from the YAML. Indentation must use spaces, not tabs, and must stay consistent within each block. Very large files may be slow, because parsing runs in your browser.
Common YAML to JSON mistakes
- Using tabs: YAML forbids tabs for indentation. Use spaces only, and set your editor to insert spaces when you press the tab key.
- Inconsistent indentation: sibling fields must line up exactly. One extra space can move a field into the wrong mapping or cause a parse error.
- Unquoted colons in strings: a colon followed by a space starts a new field in YAML. Quote strings that contain a colon and a space, such as a message with a time or a label.
- Forgetting that unquoted values have types: yes, no, on and off can be read as booleans in some YAML versions, and bare digits become numbers. Quote values that must stay text.
- Expecting comments to survive: JSON has no comments, so YAML comments are dropped. Keep notes in the YAML file, not in the converted JSON.
- Pasting only part of a file: a fragment that starts mid-mapping may parse as something different. Convert the whole document, or a complete self-contained block.
Frequently asked questions
Is valid JSON also valid YAML?
Generally yes. YAML 1.2 was designed so that JSON documents are valid YAML. That means you can paste JSON into a YAML parser, though the reverse is not true, because most YAML uses indentation and unquoted keys that JSON does not allow.
Do YAML comments appear in the JSON?
No. Comments are ignored during parsing, and JSON has no way to represent them. Keep any notes in the original YAML file.
Are anchors and aliases supported?
Yes. The js-yaml parser resolves anchors and aliases, so each alias appears in the JSON as the value it refers to. The anchor names themselves do not appear in the output.
What happens with duplicate keys?
Parsing fails with an error. Remove the repeated key from the YAML, keeping the value you intend, and convert again.
Why did my value change type?
Unquoted YAML values are typed by their form, so 123 becomes a number and true becomes a boolean. Quote the value in YAML, for example "123", when it must stay a string.
Can I convert JSON back to YAML?
Yes, use the JSON to YAML converter on this site. Keep the original YAML until you have checked the converted file, since comments and anchors do not survive a round trip.
Does my YAML leave my device?
No. Parsing runs in your browser, and nothing is uploaded or stored. Avoid pasting secrets into any web page as a general habit, even when processing is local.



