Skip to content
SPCXTools

YAML to JSON Converter

Convert configuration files between YAML and JSON in both directions, with syntax checking.

Runs locally — files never leave your device

Loading tool…

How to use YAML to JSON Converter

  1. 1Choose the direction — YAML → JSON or JSON → YAML.
  2. 2Paste your YAML or JSON into the left box, or click Sample.
  3. 3The converted result appears on the right as you type. Syntax errors are reported below with a description.
  4. 4Copy the result or download it as a .json or .yaml file. Switching direction moves the result to the input.

Convert between YAML and JSON

YAML and JSON are the two most common formats for configuration and structured data. Kubernetes manifests, Docker Compose files, CI pipelines and OpenAPI specs are usually written in YAML, while APIs, JavaScript code and many tools expect JSON. This converter translates between them in both directions as you type, and tells you exactly what's wrong when the input isn't valid.

Features

  • Two directions: YAML → JSON and JSON → YAML, with one-click switching.
  • Syntax validation with clear error messages for bad indentation, unclosed quotes and invalid JSON.
  • Multi-document YAML converted to a JSON array.
  • Anchors, aliases and merge keys resolved automatically.
  • 2 or 4 space indentation for the output.
  • Copy or download the result as .json or .yaml.
  • Private: nothing is sent to a server.

Example

This YAML:

name: web-app
replicas: 3
ports:
  - 80
  - 443
env:
  NODE_ENV: production

converts to this JSON:

{
  "name": "web-app",
  "replicas": 3,
  "ports": [80, 443],
  "env": {
    "NODE_ENV": "production"
  }
}

Common YAML mistakes

  • Tabs for indentation. YAML only allows spaces. Replace tabs with two spaces.
  • Inconsistent indentation. Items that belong together must be indented by exactly the same amount.
  • Missing space after the colon. key:value is read as a single string; write key: value.
  • Special characters in strings. Values that start with @, *, &, !, %, { or [, or contain : , need quotes.
  • Unexpected types. Version numbers like 1.10 become the number 1.1, and leading zeros can be lost. Quote values that must stay text.

Related tools

Pretty-print or minify the resulting JSON with the JSON Formatter, turn JSON into a spreadsheet with JSON to CSV, or compare two configuration files with the Diff Checker.

Frequently asked questions

What's the difference between YAML and JSON?
Both describe the same kinds of data — objects, lists, strings, numbers, booleans and null. JSON uses braces, brackets and quotes and is the standard for APIs. YAML uses indentation instead of brackets, allows comments and is popular for configuration files such as Docker Compose, Kubernetes, GitHub Actions and Ansible.
What happens to YAML comments?
JSON has no comments, so comments are dropped when converting YAML to JSON. When converting back, the YAML won't contain the original comments.
How are multiple YAML documents handled?
A YAML file can contain several documents separated by ---. When it does, the converter outputs a JSON array with one element per document.
Are anchors and aliases supported?
Yes. Anchors (&name), aliases (*name) and merge keys (<<: *name) are resolved, so the JSON contains the full expanded values.
Why does my value change type, like "no" becoming false?
This tool follows YAML 1.2, where only true and false are booleans. Older YAML 1.1 parsers also treat yes, no, on and off as booleans. If you need a value to stay a string, put it in quotes.
Is my data uploaded?
No. Parsing and conversion happen in your browser, so configuration files with secrets or internal hostnames never leave your device.