YAML to JSON converter

YAML to JSON conversion parses indented YAML and prints the same structure as JSON.

Features

  • Error messagesSyntax problems are reported with their position.
  • Multiple documentsDocuments separated by --- become a JSON array.
  • Runs on your deviceYour data is processed in the browser and is never uploaded.

How to use the YAML to JSON converter

  1. Paste YAML or open a file.
  2. Fix any reported error.
  3. Copy the JSON.

The YAML type trap

Older YAML versions read yes, no, on and off as booleans. This converter follows the core schema, where only true and false are booleans, and dates stay text.

Convert YAML to JSON in JavaScript

import yaml from 'js-yaml';
const json = JSON.stringify(yaml.load(input), null, 2);

Frequently asked questions

Are anchors and aliases supported?

Yes.

Are comments kept?

No. JSON cannot hold comments.

Why does indentation fail?

YAML does not allow tab characters for indentation.

Related tools