Nested YAML to JSON
Complex nested YAML configurations convert cleanly to JSON's bracket-based structure.
Switch tool:
Examples:
💡 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';34const yamlData = `server:5 http:6 port: 80807 host: 0.0.0.08 https:9 port: 44310 enabled: true11database:12 primary:13 host: db1.example.com14 port: 5432`;15const parsed = yaml.load(yamlData);16const jsonOutput = JSON.stringify(parsed, null, 2);17console.log(jsonOutput);1819// Output:20// {21// "server": {22// "http": {23// "port": 8080,24// "host": "0.0.0.0"...
More YAML Examples
Kubernetes YAML to JSON
Convert a Kubernetes Pod YAML configuration to JSON format.
Docker Compose to JSON
Convert Docker Compose YAML configuration to JSON format.
Simple YAML to JSON
Basic example of converting YAML configuration to JSON.
GitHub Actions to JSON
Convert GitHub Actions workflow YAML to JSON for analysis.