💻 Developer Tools

YAML ⇄ JSON Converter

Convert between YAML and JSON, with formatting and validation. It converts as you paste, and syntax errors show a line number — handy for a quick look at a config file. Nothing leaves your browser.

Examples (click to try)

How to use the YAML ⇄ JSON converter

New here? Start by clicking one of the "Examples (click to try)" chips above the input — a sample loads and the result shows right away. After that, just paste into the text area above. It converts live as you type, so there's no button to press. Press "⇅ Swap" to move the current output into the input and convert the other way.

Example: convert YAML to JSON

Paste a Docker Compose-style YAML like this:

services:
  web:
    image: nginx:latest
    ports:
      - "8080:80"
    environment:
      DEBUG: false

In "YAML → JSON" mode it converts to (2-space indent):

{
  "services": {
    "web": {
      "image": "nginx:latest",
      "ports": [
        "8080:80"
      ],
      "environment": {
        "DEBUG": false
      }
    }
  }
}

Switch to "JSON → YAML" and the same JSON turns back into YAML.

  • YAML → JSON: reads YAML and outputs formatted JSON. Choose 2- or 4-space indentation.
  • JSON → YAML: reads JSON and outputs block-style YAML. The indent width (2 or 4 spaces) applies here too.
  • Validation: on a syntax error, it shows a message with an estimated line number.
  • ⇅ Swap: moves the output into the input and flips the direction — useful for round-trip checks.

When it comes in handy

  • Inspecting CI config (GitHub Actions, GitLab CI), Docker Compose, or Kubernetes manifests
  • Feeding YAML config into a tool that only accepts JSON
  • Turning JSON config into YAML that's easier to read and edit by hand
  • Isolating YAML errors caused by misaligned indentation or stray tabs

To format and validate JSON on its own, see the JSON Formatter; to compare two JSON documents, try the JSON Diff.

FAQ

Is my YAML/JSON sent to any server?
No. All conversion, formatting and validation happens entirely within your browser. Your input is never sent to or stored on any server, so it is safe to use even with config files that contain credentials.
Which parts of YAML are supported?
Block mappings, block sequences, nesting via space indentation, flow style ([a, b] and {k: v}), quoted strings, number/true/false/null literals and # comments are supported. Compact forms such as key:value (no space after the colon) are supported too. yes/no/on/off are kept as strings. Duplicate keys are reported as an error (to avoid silently dropping data). An empty document is reported as an error. Anchors and aliases (& *), custom tags (!!), multiple documents and block scalars (| >) are not supported.
Can I see where a syntax error is?
Yes. For YAML, parse failures show an estimated line number; for JSON, the tool estimates the line and column from the browser's error. It also flags misaligned indentation and stray tabs.