Simple YAML to JSON
A simple conversion showing how YAML nested configuration translates to JSON format.
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 = `database:5 host: localhost6 port: 54327 name: myapp`;8const parsed = yaml.load(yamlData);9const jsonOutput = JSON.stringify(parsed, null, 2);10console.log(jsonOutput);1112// Output:13// {14// "database": {15// "host": "localhost",16// "port": 5432,17// "name": "myapp"...
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.
GitHub Actions to JSON
Convert GitHub Actions workflow YAML to JSON for analysis.
Nested YAML to JSON
Convert deeply nested YAML configuration to JSON.