JSON to Kubernetes YAML

Convert kubectl JSON output and API objects into clean manifests you can review and apply.

Output options

JSONinput

Empty

YAMLoutput

YAML output appears here

Runs entirely in your browser, so nothing is uploaded. Fair-use limits apply (5 MB per input, rate-limited conversions) to prevent spam and bots.

Load from URL

The file is fetched directly by your browser, so the server must allow cross-origin requests.

Keyboard shortcuts

Ctrl / ⌘ + Enter Convert now
Ctrl / ⌘ + S Download the output
Alt + Shift + C Copy the output
Alt + Shift + F Fix and format the JSON input
Alt + Shift + S Swap direction
Alt + Shift + T Cycle through code, tree and map views
Ctrl / ⌘ + Z Undo, including Format, Fix and Clear
Esc Leave full screen
Editor text size

From kubectl JSON to a clean manifest

Exported objects carry status and bookkeeping fields the cluster sets itself. Strip them first, then convert, and the result can be applied anywhere.

bash
# Export a live object as JSON and strip the fields the cluster manages
kubectl get deployment web -o json \
  | jq 'del(.status, .metadata.uid, .metadata.resourceVersion,
            .metadata.creationTimestamp, .metadata.generation,
            .metadata.managedFields)' > web.json

Paste web.json above, or upload it. Prefer a full guide? Read how to convert JSON to Kubernetes YAML.

Environment values stay strings

The API server rejects an env value that is not a string. Values that look like booleans, numbers or versions are quoted automatically.

JSON
{
  "env": [
    {
      "name": "FEATURE_FLAG",
      "value": "true"
    },
    {
      "name": "PORT",
      "value": "8080"
    },
    {
      "name": "REGION",
      "value": "no"
    },
    {
      "name": "API_VERSION",
      "value": "1.20"
    }
  ]
}
YAML
env:
  - name: FEATURE_FLAG
    value: 'true'
  - name: PORT
    value: '8080'
  - name: REGION
    value: 'no'
  - name: API_VERSION
    value: '1.20'

Turn off YAML 1.1 safe to see which values a YAML 1.1 parser would misread.

One object per document

Paste the items array of a kubectl List and turn on Multi-document to get a single file with --- between objects.

items (JSON)
[
  {
    "apiVersion": "v1",
    "kind": "ConfigMap",
    "metadata": {
      "name": "web-config"
    },
    "data": {
      "LOG_LEVEL": "info"
    }
  },
  {
    "apiVersion": "v1",
    "kind": "Service",
    "metadata": {
      "name": "web"
    },
    "spec": {
      "selector": {
        "app": "web"
      },
      "ports": [
        {
          "port": 80
        }
      ]
    }
  }
]
manifests.yaml
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: web-config
data:
  LOG_LEVEL: info
---
apiVersion: v1
kind: Service
metadata:
  name: web
spec:
  selector:
    app: web
  ports:
    - port: 80

More tools

Converters, validators and step-by-step guides for every place JSON and YAML meet.

Frequently asked questions

How do I convert Kubernetes JSON to YAML?

Paste the JSON object, for example the output of kubectl get deployment web -o json, into the editor. The YAML manifest appears on the right. Remove cluster-managed fields such as status and metadata.managedFields before applying it to another cluster.

How do I turn a kubectl List into separate manifests?

kubectl get with several objects returns {"kind": "List", "items": [...]}. Paste just the items array and turn on Multi-document: each object becomes its own document separated by ---, which is the usual layout for a manifests file.

Why are some environment variable values quoted?

Kubernetes requires env values to be strings. Unquoted, true, 8080 or no would be read as a boolean or a number and the API server would reject the manifest. The converter quotes every string that could be misread, so the YAML means exactly what the JSON did.

Can kubectl apply JSON directly?

Yes, kubectl apply -f accepts JSON as well as YAML. Teams still convert to YAML because it is easier to review in pull requests, supports comments, and is what Helm charts and Kustomize overlays expect.

Does the converter check my manifest against the Kubernetes API?

No, it converts syntax only. Run kubectl apply --dry-run=server -f manifest.yaml to have the API server validate fields and types without changing anything.