YAML to JSON

Convert YAML to JSON online for free. Paste YAML and get JSON instantly, in your browser.

Suggested tools

JSON to YAML

Convert JSON into readable YAML.

JSONYAML
Open Tool

YAML Formatter

Re-indent YAML and check it for syntax errors, with line numbers.

YAML
Open Tool

XML to YAML

Convert XML into YAML.

XMLYAML
Open Tool

YAML to XML

Convert YAML into XML.

YAMLXML
Open Tool

YAML to CSV

Convert a YAML list into CSV.

YAMLCSV
Open Tool

CSV to YAML

Convert CSV into YAML.

CSVYAML
Open Tool

About YAML to JSON

YAML to JSON converts YAML configuration into JSON for APIs, JavaScript code and tools that only read JSON. It supports anchors, aliases and merge keys (<<), and multiple documents separated by ---.

It follows YAML 1.2 rules, so words like yes, no, on and off stay text instead of becoming booleans. Invalid YAML is reported with its line number. It runs entirely in your browser, so nothing you paste is uploaded.

How to use YAML to JSON

  1. Paste YAML, upload a .yaml/.yml file or click Sample.
  2. Press Convert (choose 2 or 4 spaces).
  3. Copy or download the JSON.

Key features

  • Anchors, aliases and merge keys resolved
  • YAML 1.2 rules — no surprise booleans
  • Multi-document YAML supported
  • Line numbers for syntax errors

Example

A GitHub Actions snippet. With YAML 1.2 rules the key "on" stays text instead of becoming true.

Input
name: build
on: [push]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - run: npm test
Output
{
  "name": "build",
  "on": [
    "push"
  ],
  "jobs": {
    "test": {
      "runs-on": "ubuntu-latest",
      "steps": [
        {
          "run": "npm test"
        }
      ]
    }
  }
}

When to use YAML to JSON

  • Using YAML configuration in a tool or API that only reads JSON.
  • Checking what a YAML file really contains after anchors and merges are applied.
  • Converting OpenAPI or CI files for scripts.

Tips and common problems

  • Tabs are not allowed for indentation in YAML — replace them with spaces.
  • Several documents separated by --- become one JSON array.
  • Comments are dropped because JSON has no comments.

Frequently asked questions

JSON has no comments, so they are dropped. All the data is kept.

Guides

  • JSON vs XML vs YAML — JSON vs XML vs YAML compared: strengths, weaknesses and best uses, to help you choose the right data format for APIs, config files and documents.