YAML / JSON Converter

Convert between YAML and JSON with full support for nested structures, multi-line strings, and all YAML data types.

InputYAML — paste, type or drop a .yaml file
OutputJSON
{
  "version": "3.8",
  "services": {
    "web": {
      "image": "nginx:alpine",
      "ports": [
        "8080:80"
      ],
      "volumes": [
        "./html:/usr/share/nginx/html"
      ],
      "environment": [
        "NGINX_HOST=localhost",
        "NGINX_PORT=80"
      ],
      "depends_on": [
        "api"
      ],
      "restart": "always"
    },
    "api": {
      "build": {
        "context": "./api",
        "dockerfile": "Dockerfile"
      },
      "ports": [
        "3000:3000"
      ],
      "environment": {
        "DATABASE_URL": "postgres://user:pass@db:5432/mydb",
        "NODE_ENV": "production",
        "LOG_LEVEL": "info"
      },
      "depends_on": [
        "db"
      ]
    },
    "db": {
      "image": "postgres:15",
      "volumes": [
        "pgdata:/var/lib/postgresql/data"
      ],
      "environment": {
        "POSTGRES_USER": "user",
        "POSTGRES_PASSWORD": "pass",
        "POSTGRES_DB": "mydb"
      }
    }
  },
  "volumes": {
    "pgdata": null
  }
}
Valid YAML28 keysDepth 4694 B YAML → 1005 B JSONProcessed locally

How to use it

  1. Pick a direction — YAML → JSON or JSON → YAML — then paste, type or drop a .yaml or .json file into the input.
  2. The output updates as you type; set the indent, sort keys, compact arrays or quote all strings, and fix any error using the line and column shown.
  3. Copy or download the result, press Swap to convert it back the other way, or send the JSON to another tool.

Related tools

JSON FormatterFormatData Format ViewerFormatDocker Run to ComposeDevOps

What is YAML vs JSON?

YAML (YAML Ain't Markup Language) and JSON (JavaScript Object Notation) are both data serialization formats. YAML uses indentation for structure and supports comments, making it popular for configuration files. JSON uses braces and brackets, is natively supported in JavaScript, and is the standard for APIs. This converter transforms between both formats instantly.

Common use cases

  • Converting Docker Compose YAML to JSON for programmatic access
  • Transforming Kubernetes manifests between YAML and JSON
  • Converting GitHub Actions workflows for debugging
  • Migrating configuration from JSON to YAML or vice versa
  • Validating YAML syntax by round-tripping through JSON

Frequently asked questions

When should I use YAML vs JSON?

Use YAML for human-edited configuration files (Docker Compose, Kubernetes, CI/CD) where comments and readability matter. Use JSON for API payloads, data interchange, and programmatic access where parsing speed and strict syntax are important.

Does JSON support comments?

Standard JSON (RFC 8259) does not support comments. YAML supports both line comments (#) and is more human-friendly for configuration. Some tools support JSON5 or JSONC which allow comments, but these aren't standard JSON.