YAML to JSON Converter
Convert YAML to JSON and JSON to YAML in either direction, instantly. Paste your data, pick a direction and an indent, and get clean, formatted output that round-trips correctly. Everything runs locally in your browser — nothing is uploaded, so the tool works offline and never sees your data.
How To Use
- Paste your YAML or JSON into the input box.
- Choose the conversion Direction — YAML to JSON or JSON to YAML.
- Select the output Indent (2 or 4 spaces) for the result.
- Click Convert to run the conversion.
- Review the formatted output and click Copy result to send it to your clipboard.
You can also press Ctrl+Enter (or Cmd+Enter on a Mac) inside the input box to convert without reaching for the button. The Demo button fills a sample dataset so you can see the output format instantly.
Usage Example
Converting a short YAML document to JSON. Notice how comments and anchors are dropped and the nested list becomes a JSON array:
YAML input
# # Company profile # name: Acme founded: 2020 active: true offices: - New York - London - Berlin
JSON output
{
"name": "Acme",
"founded": 2020,
"active": true,
"offices": [
"New York",
"London",
"Berlin"
]
}
The content is identical after conversion, but the # comment
line does not appear in the JSON output because JSON has no comment
syntax. Values keep their types: quoted strings stay strings, bare
numbers stay numbers, true/false stay booleans,
and null maps to JSON null. Sequences in YAML
become JSON arrays and mappings become JSON objects.
Frequently Asked Questions
Does JSON output preserve my YAML comments and anchors?
No. JSON has no comment or anchor/alias syntax, so comments are dropped and anchors/aliases are resolved to their full values during conversion. This is a fundamental trade-off of moving from YAML to JSON — the data is preserved, but the human-readable annotations are lost. Converting back to YAML will not restore them.
Does this tool support multi-document YAML streams?
No. Only a single YAML document is supported per conversion. If you paste a stream with multiple documents separated by --- markers, you will get a clear error asking you to provide a single document, since a JSON file can hold only one JSON value.
What happens if my YAML or JSON is invalid?
You get a clear, human-readable error explaining what went wrong, and the previous output is cleared. Nothing is silently ignored, and the page never crashes — just fix the input and press Convert again.
Is this tool local? Is my data uploaded?
Yes, it is 100% local. The conversion runs entirely in your browser using a bundled parser, with no network requests and no server upload. You can even disconnect from the internet and it still works.
Does the converter preserve my key order?
Yes. js-yaml keeps the order of keys as they appear in your input, and the JSON output mirrors that order, so your mapping sequence stays the same in both directions.