🛠️DevTools

JSON to Kubernetes YAML

This example converts a JSON Kubernetes Pod configuration to YAML format, which is the standard format for Kubernetes manifests.

Switch tool:
Examples:
YAML output will appear here...

💡 Paste your JSON and it converts to YAML automatically. Perfect for Kubernetes, Docker Compose, and other DevOps configurations.

Code Examples

Here's how to achieve this in different programming languages:

1// Using js-yaml library (npm install js-yaml)
2import yaml from 'js-yaml';
3
4const jsonData = `{"apiVersion": "v1", "kind": "Pod", "metadata": {"name": "my-pod"}, "spec": {"containers": [{"name": "web", "image": "nginx:latest", "ports": [{"containerPort": 80}]}]}}`;
5const parsed = JSON.parse(jsonData);
6const yamlOutput = yaml.dump(parsed);
7console.log(yamlOutput);
8
9// Output:
10// apiVersion: v1
11// kind: Pod
12// metadata:
13// name: my-pod
14// spec:
15// containers:
16// - name: web
17// image: nginx:latest
18// ports:
19// - containerPort: 80

More JSON Examples

Related JSON Tools

📚 Learn More