Skip to content

YAML to JSON Converter

Convert YAML to JSON as you type, from pasted text or a .yml file. Errors name the line to fix.

Input · YAML
⇄
Output · JSON
Valid YAMLRuns in your browser

Load from a URL

Your browser fetches it directly, so the server must allow cross-origin requests (CORS).

How to convert YAML to JSON

  1. Paste YAML or open a .yaml or .yml file. The JSON appears as you type.
  2. Pick the JSON Indent: 2 spaces, 4 spaces or tabs.
  3. Press ⇄ to send the JSON to JSON to YAML.

A mistake in the YAML shows the line to fix instead. The YAML validator shows the same message beside your code and can re-indent the file.

Several documents become an array

Documents separated by ---, as in many Kubernetes manifests:

apiVersion: v1
kind: Service
metadata:
  name: api
spec:
  ports:
    - port: 80
      targetPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: api
spec:
  replicas: 3

become one array, with a note saying how many were found:

[
  {
    "apiVersion": "v1",
    "kind": "Service",
    "metadata": {
      "name": "api"
    },
    "spec": {
      "ports": [
        {
          "port": 80,
          "targetPort": 8080
        }
      ]
    }
  },
  {
    "apiVersion": "apps/v1",
    "kind": "Deployment",
    "metadata": {
      "name": "api"
    },
    "spec": {
      "replicas": 3
    }
  }
]

YAML 1.2, not 1.1

YAML 1.1 read many plain words as booleans and dates; this converter follows YAML 1.2. Compared with PyYAML, a YAML 1.1 parser:

YAML JSON here PyYAML
country: NO "NO" False
debug: off "off" False
on: push key "on" key True
released: 2026-11-05 "2026-11-05" a date
mode: 0755 755 493 (octal)
version: 1.10 1.1 1.1

So a GitHub Actions on: key stays "on". The last row catches both: an unquoted version number is a float, and 1.10 loses its zero.

What JSON cannot hold

Comments are dropped, since JSON has no comments, and .inf and .nan become null. Large results are easier to browse in the JSON viewer.

Questions

Is a .yml file different from a .yaml file?

No, both extensions mean the same format, and both open here.

How do I keep a value as a string?

Quote it, for example version: "1.10". A quoted scalar is always a string.

What happens to anchors and aliases?

Each alias such as *base becomes a full copy of the anchored value, because JSON has no references.

Related tools

Esc