Advertisement728 × 90 — Leaderboard
Advertisement320 × 50 — Mobile banner

YAML to JSON Online

Convert YAML to JSON format instantly
Session restored from your last visit
Also need:JSON to YAMLYAML FormatterJSON Formatter
Advertisement — Fullscreen
Input
Output
Input
AdvertisementResponsive
Output
Copy as JSON
Copy Escaped
Copy as Base64
Copy as cURL
Ready0 chars0 lines
Advertisement728 × 90

About YAML to JSON Online

Paste your YAML and instantly get valid, pretty-printed JSON output. Handles multi-document YAML, anchors, and aliases. Free, browser-based, no data sent to any server.

Frequently Asked Questions

What is YAML to JSON conversion?
YAML to JSON conversion parses a YAML document and serialises it as JSON. The data is identical; only the syntax changes. JSON uses braces and brackets where YAML uses indentation. JSON is preferred for APIs and programmatic parsing; YAML for human-edited configuration.
Can YAML with anchors and aliases be converted to JSON?
Yes, but anchors and aliases are expanded during conversion — each alias is replaced with a copy of the anchored value. JSON has no equivalent of anchors, so the output may be larger with repeated blocks. The data is fully preserved, just without the YAML shorthand.
Are YAML comments preserved when converting to JSON?
No. JSON has no comment syntax, so all YAML comments are discarded during conversion. If you need to preserve documentation alongside data, consider keeping the original YAML file as the source of truth and generating JSON from it as a build step.
What happens to YAML multi-line strings when converting to JSON?
YAML block scalars (| for literal, > for folded) are converted to JSON strings. Literal blocks preserve newlines. Folded blocks convert newlines to spaces. The content is preserved in both cases — JSON represents multi-line text as a single string with \n escape sequences.
How do I convert YAML to JSON in Python or Node.js without this tool?
Python: import yaml, json; print(json.dumps(yaml.safe_load(open("file.yaml")), indent=2)). Requires PyYAML: pip install pyyaml. Node.js: const yaml = require("js-yaml"); console.log(JSON.stringify(yaml.load(fs.readFileSync("file.yaml")), null, 2)). Requires: npm install js-yaml.
Advertisement300 × 250
Advertisement300 × 250
Ad
AdvertisementSticky banner
Ad
AdvertisementSticky banner