🛠️DevTools

Nested YAML to JSON

Complex nested YAML configurations convert cleanly to JSON's bracket-based structure.

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

💡 Paste your YAML and it converts to JSON automatically. Perfect for converting Kubernetes and Docker Compose configs.

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 yamlData = `server:
5 http:
6 port: 8080
7 host: 0.0.0.0
8 https:
9 port: 443
10 enabled: true
11database:
12 primary:
13 host: db1.example.com
14 port: 5432`;
15const parsed = yaml.load(yamlData);
16const jsonOutput = JSON.stringify(parsed, null, 2);
17console.log(jsonOutput);
18
19// Output:
20// {
21// "server": {
22// "http": {
23// "port": 8080,
24// "host": "0.0.0.0"...

More YAML Examples

Related YAML Tools

📚 Learn More