YAML ↔ JSON

Convert between YAML & JSON in your browser.

Free online YAML formatter and JSON converter. Paste, switch direction, validate, and download. Works for OpenAPI specs, Kubernetes manifests, and GitHub Actions.

Two-way conversionPretty-printedLocal — no upload
Indent:

YAML input

Paste your YAML — Kubernetes, OpenAPI, GitHub Actions, anything valid.

Valid · 381 B in → 623 B out
JSON outputjson
{
  "apiVersion": "apps/v1",
  "kind": "Deployment",
  "metadata": {
    "name": "nginx-deployment",
    "labels": {
      "app": "nginx"
    }
  },
  "spec": {
    "replicas": 3,
    "selector": {
      "matchLabels": {
        "app": "nginx"
      }
    },
    "template": {
      "metadata": {
        "labels": {
          "app": "nginx"
        }
      },
      "spec": {
        "containers": [
          {
            "name": "nginx",
            "image": "nginx:1.27",
            "ports": [
              {
                "containerPort": 80
              }
            ]
          }
        ]
      }
    }
  }
}
Input: yaml · Output: json

Working with OpenAPI specs?

Try the OpenAPI → Markdown converter and let Dokly publish your API reference automatically.

OpenAPI → Markdown →

YAML, JSON, and when to use which

JSON is what machines speak: strict, predictable, every key in double quotes. It's the right format for APIs, config files consumed by code, and anywhere whitespace can't be trusted.

YAML is what humans prefer to write: comments, multi-line strings, no curly brace soup. It's why Kubernetes manifests, GitHub Actions workflows, OpenAPI specs, and Ansible playbooks all use YAML — they live in version control and are read by humans more often than machines.

When to convert

  • YAML → JSON: you have a Kubernetes manifest, OpenAPI spec, or CI workflow and need to feed it to a tool that only accepts JSON.
  • JSON → YAML: an API returned JSON and you want to commit a readable version into your repo, or you're migrating a config from JSON to a YAML-native tool.
  • Format / pretty-print: paste in messy YAML or minified JSON, and the converter re-indents the output cleanly with your chosen indent width.

Privacy

Everything runs in your browser. Your YAML and JSON never leave your machine — there's no server round-trip, no analytics on the payload, no cookies set. Safe for secrets-adjacent configs (still: don't paste real secrets anywhere you don't control).