🛠️DevTools

Docker Compose to JSON

This example converts a Docker Compose configuration from YAML to JSON format.

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 = `version: "3.8"
5services:
6 web:
7 image: nginx
8 ports:
9 - "80:80"`;
10const parsed = yaml.load(yamlData);
11const jsonOutput = JSON.stringify(parsed, null, 2);
12console.log(jsonOutput);
13
14// Output:
15// {
16// "version": "3.8",
17// "services": {
18// "web": {
19// "image": "nginx",...

More YAML Examples

Related YAML Tools

📚 Learn More