YAML to JSON Converter
Convert YAML to JSON, multi-document files included
What is YAML to JSON Converter?
A YAML to JSON converter parses YAML configuration and emits standard JSON you can consume directly in code or feed into a diff. Multi-document YAML separated by --- is supported, and all parsing happens locally in your browser.
How to use YAML to JSON Converter
- 1Paste your YAML, including files with several --- separated documents.
- 2Review the JSON output; multi-document input is emitted as a JSON array.
- 3Choose an indentation width, or minify the result down to a single line.
- 4If parsing fails, go to the reported line number and check the indentation and any stray tab characters.
How do I do this in code?
Use the tool above for one-off work; for anything you repeat, move it into a script or your project.
import yaml from 'js-yaml'; const data = yaml.load(raw); const json = JSON.stringify(data, null, 2);
Common errors and how to fix them
| Symptom | Cause | Fix |
|---|---|---|
| Date fields turn into objects, or come out inconsistently as strings | YAML parses an unquoted value such as 2026-07-31 as a date type, and JSON has no date type to map it onto. | Quote the value in the YAML source when you need it to stay a string. |
Frequently asked questions
Are YAML anchors and aliases (& and *) converted correctly?+
Yes. The parser expands aliases while loading, so the JSON output contains the fully expanded structure. Because shared content is duplicated at every reference, the result can be noticeably larger than the original YAML.
Why did my comments disappear in the JSON?+
The JSON spec has no comment syntax, so YAML comments are necessarily lost in the conversion. If a comment carries information you need, move it into a real data field such as description, or keep the original YAML file in version control as the source of truth.
Related tools
All toolsJSON to YAML Converter
Convert JSON to YAML while preserving the nesting
JSON to CSV Converter
Convert a JSON array of objects to CSV, with nested fields flattened automatically
CSV to JSON Converter
Convert CSV to JSON with automatic header and delimiter handling
JSON to TypeScript
Infer TypeScript type definitions from JSON
JSON to Go Struct
Convert JSON to Go structs with json tags filled in
JSON to Python Dataclass
Convert JSON to Python dataclasses or Pydantic models