Skip to content
Esc
  • MQTT Topic MatcherTest MQTT topic filters with + and # wildcards against topics, and check ACL patterns.
  • JSON FormatterBeautify, minify and validate JSON instantly as you type.
  • JSON DiffCompare two JSON documents and see every added, removed and changed value by path.
  • JSON to TypeScriptGenerate TypeScript interfaces or Zod schemas from a sample JSON response.
  • Base64 Encoder/DecoderConvert text to Base64 and back, with full Unicode support.
  • UUID GeneratorGenerate random v4 UUIDs — one or many — in the format you need.
  • JWT DecoderDecode JSON Web Tokens to inspect the header, payload and expiry.
  • Timestamp ConverterConvert Unix timestamps to dates and dates to timestamps.
  • URL Encoder/DecoderPercent-encode and decode URLs, and break down query strings.
  • Hash GeneratorGenerate MD5, SHA-1, SHA-256 and SHA-512 hashes of text or files.
  • Regex TesterTest regular expressions with live match highlighting and groups.
  • YAML to JSON ConverterConvert YAML to JSON and JSON to YAML, with clear error locations.
  • SQL FormatterBeautify or minify SQL for PostgreSQL, MySQL, SQL Server and 9 more dialects.
  • Mock Data GeneratorGenerate realistic fake data for API mocks as JSON, CSV or SQL inserts.
  • HTTP Header AnalyzerGrade response headers: CSP, HSTS, cookies, CORS and caching, explained.
  • Webhook Signature VerifierVerify and generate webhook signatures for GitHub, Stripe, Slack, Shopify and more.
  • Cron Expression GeneratorBuild and explain cron schedules, with the next run times in any time zone.
  • .env File ValidatorFind syntax errors, duplicates and missing keys in .env files.
  • HTML to JSX ConverterConvert HTML to valid React JSX: className, style objects, self-closing tags.
  • SVG to React ComponentTurn SVG files into React icon components with props and currentColor.
  • Markdown EditorWrite Markdown with a live preview, GitHub tables and task lists, and HTML export.

↑ ↓ to moveEnter to openPaste data to open it in the right tool. Nothing leaves your browser.

YAML to JSON Converter

Paste YAML to get JSON, or flip the direction to turn JSON into YAML. Errors show the line and column, and anchors and multi-document files are handled.

Last updated

YAML

JSON

Converted
{
  "services": {
    "api": {
      "image": "devnest/api:1.4.2",
      "ports": [
        "8080:8080"
      ],
      "environment": {
        "LOG_LEVEL": "info",
        "FEATURE_FLAGS": [
          "search",
          "exports"
        ]
      },
      "healthcheck": {
        "test": [
          "CMD",
          "curl",
          "-f",
          "http://localhost:8080/health"
        ],
        "interval": "30s",
        "retries": 3
      }
    }
  }
}

How to use the YAML to JSON Converter

  1. Choose a direction

    YAML → JSON is selected by default. Switch to JSON → YAML to go the other way.

  2. Paste your data

    Paste a config file, Kubernetes manifest, OpenAPI spec or any other YAML or JSON.

  3. Fix any errors

    If the input is invalid, the output panel shows the problem with its line and column.

  4. Copy or download

    Copy the result or download it as a .json or .yaml file. Switching direction moves the result into the input.

Features

  • Converts YAML to JSON and JSON to YAML, updating as you type
  • Error messages with the exact line and column
  • Anchors, aliases and << merge keys are expanded in the JSON output
  • Multi-document YAML (separated by ---) becomes a JSON array
  • 2- or 4-space indentation
  • Switching direction moves the current result into the input, so you can round-trip
  • Copy, or download as .json or .yaml — also with Ctrl/Cmd + Enter and Ctrl/Cmd + S

Privacy

Your YAML and JSON are processed by JavaScript in your browser tab. Nothing is uploaded or stored, and the page's security policy blocks it from sending data to any other site.

Read the DevNest privacy policy

Examples

  • Kubernetes manifest to JSON

    Indentation becomes nested objects and dashes become arrays.

    YAML

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: api
    spec:
      replicas: 3
      template:
        spec:
          containers:
            - name: api
              image: devnest/api:1.4.2
              ports:
                - containerPort: 8080

    JSON

    {
      "apiVersion": "apps/v1",
      "kind": "Deployment",
      "metadata": {
        "name": "api"
      },
      "spec": {
        "replicas": 3,
        "template": {
          "spec": {
            "containers": [
              {
                "name": "api",
                "image": "devnest/api:1.4.2",
                "ports": [
                  {
                    "containerPort": 8080
                  }
                ]
              }
            ]
          }
        }
      }
    }
  • Anchors and merge keys

    << copies the anchored defaults, and the local timeout overrides them.

    YAML

    defaults: &defaults
      retries: 3
      timeout: 30
    production:
      <<: *defaults
      timeout: 60

    JSON

    {
      "defaults": {
        "retries": 3,
        "timeout": 30
      },
      "production": {
        "retries": 3,
        "timeout": 60
      }
    }
  • JSON to YAML

    Turn a minified JSON config into readable YAML. Loads with JSON → YAML selected.

    JSON

    {"name":"sensor-gateway","version":"2.1.0","scripts":{"start":"node index.js"},"keywords":["mqtt","iot"]}

    YAML

    name: sensor-gateway
    version: 2.1.0
    scripts:
      start: node index.js
    keywords:
      - mqtt
      - iot
    

Understanding YAML and JSON

YAML vs JSON

YAML and JSON describe the same kinds of data — objects, arrays, strings, numbers, booleans and null. JSON is strict and easy for programs to parse; YAML is designed for people, with indentation instead of braces, comments and less punctuation. That's why config files (Docker Compose, Kubernetes, GitHub Actions) use YAML while APIs use JSON.

AspectYAMLJSON
StructureIndentationBraces and brackets
CommentsYes (#)No
Quotes on stringsUsually optionalAlways double quotes
Anchors and referencesYes (& and *)No
Multiple documents per fileYes (---)No

Anchors, aliases and merge keys

YAML can define a value once with &name and reuse it with *name. The << merge key copies the keys of an anchored map into another map. JSON has no equivalent, so the converter writes out the full values:

defaults: &defaults
  retries: 3
  timeout: 30
production:
  <<: *defaults
  timeout: 60

→ "production": { "retries": 3, "timeout": 60 }

Common YAML mistakes

  • Tabs for indentation — YAML only allows spaces.
  • Inconsistent indentation inside one list or map.
  • A missing space after the colon: key:value is a single string, not a key and a value.
  • Unquoted values that start with special characters such as *, &, @ or {.
  • Values like yes, no, on and off are booleans in YAML 1.1 tools but strings in YAML 1.2 (this converter follows 1.2). Quote them to be safe.

Frequently asked questions

Can I convert JSON to YAML too?

Yes. Switch the direction to JSON → YAML. Switching moves the current result into the input, so you can convert back and forth.

What happens to comments when converting YAML to JSON?

They are dropped, because JSON has no comment syntax. Converting JSON back to YAML won't bring them back.

How are multiple YAML documents converted?

A file with several documents separated by --- becomes a JSON array, with one item per document.

Does it support anchors and merge keys?

Yes. Aliases (*name) are replaced with the anchored value and << merge keys are expanded, because JSON can't express references.

Which YAML version is used?

YAML 1.2, via the open-source yaml library. In 1.2, words like yes, no, on and off are strings rather than booleans.