Docker Compose to JSON
This example converts a Docker Compose configuration from YAML 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 = `version: "3.8"5services:6 web:7 image: nginx8 ports:9 - "80:80"`;10const parsed = yaml.load(yamlData);11const jsonOutput = JSON.stringify(parsed, null, 2);12console.log(jsonOutput);1314// Output:15// {16// "version": "3.8",17// "services": {18// "web": {19// "image": "nginx",...
More YAML Examples
Kubernetes YAML to JSON
Convert a Kubernetes Pod 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.
Nested YAML to JSON
Convert deeply nested YAML configuration to JSON.