YAML to JSON Converter (and JSON to YAML)

Convert YAML to JSON or JSON to YAML instantly, with clear errors that point to the line. Free, and it runs in your browser.

Nothing is uploaded. Conversion happens in your browser. Your config files are not sent to a server or stored.
Load a YAML example:

How to convert YAML to JSON

  1. Pick a direction, YAML → JSON or JSON → YAML, and paste your text, or load an example.
  2. Choose the indent. The result updates as you type; errors name the line and column.
  3. Copy the output or download it as a file. Use Swap to feed the output back in as the new input.
  4. To check the JSON is valid, or turn it into types, use the JSON Validator or JSON to TypeScript tool. Starting from a spreadsheet? Try CSV to JSON.

Worked example

This YAML:

name: CI
on:
  push:
    branches: [main]
steps:
  - run: npm test

becomes this JSON:

{
  "name": "CI",
  "on": { "push": { "branches": ["main"] } },
  "steps": [{ "run": "npm test" }]
}

Things to know: comments are dropped (JSON has none), anchors and aliases are expanded, and unquoted values are typed by YAML's rules (8080 is a number, true a boolean, ~ null). A file with several documents separated by --- becomes an array. These are the usual steps when feeding Docker Compose, Kubernetes or CI config to a tool that only reads JSON, such as kubectl with -o json, jq or an API.

Frequently Asked Questions (FAQ)

Is my YAML or JSON uploaded anywhere?

No. Conversion runs entirely in your browser with the open-source js-yaml parser. Nothing is sent to a server, which matters when your config contains hostnames or secrets. Still, avoid pasting live credentials into any website.

How do I convert YAML to JSON?

Paste your YAML into the input, keep the direction on YAML → JSON, and the JSON appears instantly. Pick 2 or 4 spaces or a tab for the output, then copy or download it.

What happens to YAML comments and anchors?

JSON has no comments, so comments are dropped. Anchors and aliases (&name and *name) are resolved: each alias is replaced with a copy of the anchored value, and merge keys (<<) are expanded. Converting back to YAML therefore will not restore the comments or anchors.

Why did my value become a number or boolean?

YAML guesses types from unquoted values. 8080 becomes a number, true becomes a boolean, null and ~ become null. Quote a value ("8080", "true") to keep it a string. When converting to YAML, strings that look like another type, such as "yes" or "123", are quoted automatically so they survive a round trip.

Can it convert multi-document YAML?

Yes. A file with several documents separated by --- (common in Kubernetes manifests) is converted to a JSON array with one element per document.

Why do I get a YAML error about indentation?

YAML uses spaces for structure and does not allow tabs for indentation. The usual causes are a tab character, items in a list not lined up, or a missing space after a colon. The error shown includes the line and column to jump to.

What is the difference between YAML and JSON?

YAML is a superset-style, human-friendly format with comments, anchors and indentation-based structure, popular for configuration. JSON is stricter and simpler, with explicit braces and quotes, and is the standard for APIs. Most tools that read one can be given the other after conversion.