YAML to JSON Converter

Convert YAML to JSON, multi-document files included

Runs in your browserUtility02Converters

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

  1. 1Paste your YAML, including files with several --- separated documents.
  2. 2Review the JSON output; multi-document input is emitted as a JSON array.
  3. 3Choose an indentation width, or minify the result down to a single line.
  4. 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

SymptomCauseFix
Date fields turn into objects, or come out inconsistently as stringsYAML 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 tools