~/json-yaml-converter

Convert a Kubernetes Deployment between YAML and JSON

A Kubernetes Deployment manifest converted between YAML (human-readable, what you write) and JSON (what kubectl actually sends to the API server). YAML 1.2 schema, round-trip safe.

# context

Kubernetes manifests are YAML on disk because of comments and indentation, but every kubectl call serializes them to JSON before hitting the API. Converting both directions is useful when (a) a tool only accepts JSON, (b) you want to diff two manifests structurally, or (c) you are debugging why an admission webhook rejected your YAML.

# sample (JSON)

{
  "apiVersion": "apps/v1",
  "kind": "Deployment",
  "metadata": {
    "name": "web",
    "labels": { "app": "web" }
  },
  "spec": {
    "replicas": 3,
    "selector": { "matchLabels": { "app": "web" } },
    "template": {
      "metadata": { "labels": { "app": "web" } },
      "spec": {
        "containers": [
          {
            "name": "nginx",
            "image": "nginx:1.27",
            "ports": [{ "containerPort": 80 }]
          }
        ]
      }
    }
  }
}

→ Open in JSON ↔ YAML converter (pre-filled)

# notes

# other examples