JSON to Kubernetes YAML
Convert kubectl JSON output and API objects into clean manifests you can review and apply.
JSONinput
YAMLoutput
Each line of the output, in default formatting, next to the path of the value it holds. Click a row to copy the path.
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.
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.
# 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.
{
"env": [
{
"name": "FEATURE_FLAG",
"value": "true"
},
{
"name": "PORT",
"value": "8080"
},
{
"name": "REGION",
"value": "no"
},
{
"name": "API_VERSION",
"value": "1.20"
}
]
} 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.
[
{
"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
}
]
}
}
] ---
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.
Converters
Format & validate
Convert by use case
- Docker Compose Build compose.yaml from JSON, including ports, environment and volumes.
- GitHub Actions Write workflow files from JSON without the on: / true trap.
- OpenAPI / Swagger Convert OpenAPI 3 and Swagger 2.0 specs between JSON and YAML.
- CloudFormation Convert AWS CloudFormation templates from JSON to YAML, intrinsic functions included.
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.