🛠️DevTools

Nested JSON to YAML

Complex nested configurations are clearly represented with YAML's indentation-based structure.

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 = `{"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);
8
9// Output:
10// server:
11// http:
12// port: 8080
13// host: 0.0.0.0
14// https:
15// port: 443
16// cert: /path/to/cert.pem
17// key: /path/to/key.pem
18// database:
19// primary:
20// host: db1.example.com
21// port: 5432
22// replica:
23// host: db2.example.com
24// port: 5432

More JSON Examples

Related JSON Tools

📚 Learn More