Nested JSON to YAML
Complex nested configurations are clearly represented with YAML's indentation-based structure.
Switch tool:
Examples:
💡 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';34const jsonData = `{"server": {"http": {"port": 8080, "host": "0.0.0.0"}, "https": {"port": 443, "cert": "/path/to/cert.pem", "key": "/path/to/key.pem"}}, "database": {"primary": {"host": "db1.example.com", "port": 5432}, "replica": {"host": "db2.example.com", "port": 5432}}}`;5const parsed = JSON.parse(jsonData);6const yamlOutput = yaml.dump(parsed);7console.log(yamlOutput);89// Output:10// server:11// http:12// port: 808013// host: 0.0.0.014// https:15// port: 44316// cert: /path/to/cert.pem17// key: /path/to/key.pem18// database:19// primary:20// host: db1.example.com21// port: 543222// replica:23// host: db2.example.com24// port: 5432
More JSON Examples
JSON to Kubernetes YAML
Convert JSON deployment configuration to Kubernetes YAML format.
JSON to Docker Compose
Convert JSON service configuration to Docker Compose YAML format.
Simple JSON to YAML
Basic example of converting a JSON object to YAML.
JSON to GitHub Actions
Convert JSON workflow definition to GitHub Actions YAML format.