Skip to content
Devtoolry

YAML to JSON

Convert YAML documents to formatted JSON online with syntax validation. Errors are reported by line, so broken indentation is quick to find and fix.

Runs in your browser · Nothing uploadedFree · No sign-up

Something not working, or missing a feature? Send feedback

About the YAML to JSON

The YAML to JSON converter validates YAML and outputs formatted JSON, which is useful for APIs, JSON Schema checks and seeing exactly how YAML values are interpreted.

Conversion happens in your browser, so your files and records stay private.

How to use the YAML to JSON

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

Example

Expand anchors and aliases

Input

image: &node node:22
jobs:
  test:
    image: *node
    script: npm test
  lint:
    image: *node
    script: npm run lint

Result

{
  "image": "node:22",
  "jobs": {
    "test": {
      "image": "node:22",
      "script": "npm test"
    },
    "lint": {
      "image": "node:22",
      "script": "npm run lint"
    }
  }
}

The &node anchor is defined once and each *node alias is replaced by its value, so the JSON repeats it in full.

Common mistakes

  • Numbers that should be strings. version: 1.10 converts to the number 1.1. Quote such values in the YAML ("1.10") to keep them as text.
  • Merge keys (<<) are not merged. YAML 1.2 has no merge key, so <<: *defaults is kept as a key named "<<" instead of copying the fields. GitLab CI and Docker Compose apply merges themselves; expand them by hand if your consumer does not.
  • Multiple documents. A file with several documents separated by --- converts to more than one JSON value. Split it, or convert one document at a time.
  • Indentation errors. The error shows the line and column. Usually one key is indented by a different number of spaces than its siblings.

Works well with the YAML to JSON

Frequently asked questions

What happens to comments?

JSON has no comments, so they are dropped.

How are anchors and aliases handled?

They are expanded, so the JSON contains the full repeated values.

Which YAML version is supported?

YAML 1.2, the current version, so only true and false are booleans. yes and no stay strings.

Is my config uploaded?

No. Parsing happens in your browser, so secrets stay on your device.

Guides and tutorials