JSON Formatter Pro

Converter

YAML to JSON Converter Pro

Convert Kubernetes manifests, Docker Compose files, GitHub Actions workflows, and OpenAPI specs from YAML into clean, formatted JSON.

Nothing you paste leaves your browser

What is YAML to JSON conversion?

YAML to JSON conversion parses a YAML document — the indentation-based format used for configuration — and rewrites it as equivalent JSON. Because YAML 1.2 is a superset of JSON, the two share a single data model, so the conversion is lossless: YAML’s indented keys become JSON objects, its dash-prefixed lists become JSON arrays, and scalar values keep their types, with numbers staying numbers, true or false staying booleans, and unquoted text becoming strings. This is useful whenever a tool, API, or piece of code expects JSON but your source of truth is a YAML file such as a Kubernetes manifest, a Docker Compose file, or a CI pipeline definition. JSON Formatter Pro converts YAML to JSON entirely in your browser using a Web Worker, so a manifest containing secrets or environment details is never uploaded to a server. Paste YAML or upload a file, and get well-formed JSON ready to copy or download.

Worked example: YAML → JSON

YAML to JSON conversion example Example: YAML input on the left is converted to JSON output on the right. YAML name: api-serverreplicas: 3debug: false convert JSON { "name": "api-server", "replicas": 3, "debug": false}
Turns a manifest or CI config back into JSON, preserving numbers, booleans, nesting, and sequences.

How YAML constructs map to JSON

YAML JSON
indented key: value object
dash list (- item) array
number number
true / false boolean
unquoted text string
null / ~ null

Complete Guide to Converting YAML Configuration Files to JSON

Almost every configuration file in a modern deployment pipeline is written in YAML: Kubernetes manifests, Helm values, `docker-compose.yml`, GitHub Actions and GitLab CI workflows, Ansible playbooks, and increasingly OpenAPI specifications. YAML won that territory because humans have to read and review these files in pull requests, and indentation is kinder to the eye than nested braces.

Machines, however, mostly still want JSON. A `kubectl` admission webhook, a JSON Schema validator, an OPA/Rego policy, a Postman or Swagger import, a jq query, a test fixture, or the request body of the API you are about to POST to — all of them expect JSON. That mismatch is why "convert YAML to JSON" is one of the most-run conversions in a DevOps workflow, and it is usually needed in a hurry, in the middle of debugging something.

YAML to JSON Converter Pro handles that conversion instantly, in the browser, with no upload step — which matters because the files involved are frequently the ones holding your credentials.

How to Convert YAML to JSON Online

  1. Paste or Drop Your YAML: Paste a YAML document into the left editor, or use Upload to drop a `.yaml` or `.yml` file straight in.
  2. Watch the Status Pill: The status bar reports Valid YAML or Invalid YAML as you type, and an invalid document shows the parser's own reason — for example Tab indentation on line 4. YAML requires spaces for indentation.
  3. Read the JSON Output: The YAML → JSON panel renders syntax-highlighted JSON as soon as the document parses. The indent selector (2, 3, 4 spaces or tabs) controls how that JSON is formatted.
  4. Copy or Download: Copy puts the JSON on your clipboard; Download saves it as `converted.json`.

Worked Example: A GitHub Actions Workflow as JSON

This is a real pass through the converter — a trimmed workflow file on the left, the exact JSON it produces on the right, at the default two-space indent. Note what happens to the parts people usually get wrong: the comment is dropped (JSON has no comments), the flow sequence `[main, release/*]` becomes a JSON array, `timeout-minutes: 15` becomes a number while `ubuntu-latest` stays a string, the sequence of maps under `steps` becomes an array of objects, and the `|` block scalar collapses into one string whose line breaks are `\n` escapes.

Input — deploy.yml

# deploy pipeline
name: deploy
on:
  push:
    branches: [main, release/*]
jobs:
  build:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    env:
      REGISTRY: ghcr.io
      DRY_RUN: false
    steps:
      - uses: actions/checkout@v4
      - name: Build image
        run: |
          docker build -t $REGISTRY/app:$SHA .
          docker push $REGISTRY/app:$SHA

Output — converted.json

{
  "name": "deploy",
  "on": {
    "push": {
      "branches": [
        "main",
        "release/*"
      ]
    }
  },
  "jobs": {
    "build": {
      "runs-on": "ubuntu-latest",
      "timeout-minutes": 15,
      "env": {
        "REGISTRY": "ghcr.io",
        "DRY_RUN": false
      },
      "steps": [
        {
          "uses": "actions/checkout@v4"
        },
        {
          "name": "Build image",
          "run": "docker build -t $REGISTRY/app:$SHA .\ndocker push $REGISTRY/app:$SHA\n"
        }
      ]
    }
  }
}

Key Technical Capabilities

☸️ Real Manifest Shapes

Nested mappings by indentation, block sequences, sequences of maps (`- name: api`), and `|` / `>` block scalars — the exact constructs a Deployment, Compose service or workflow file is built from.

🧭 YAML 1.2 Core Scalar Rules

`NO`, `on` and `off` stay strings, so country codes and feature flags survive intact. Numbers convert only when they round-trip exactly — `007` and `1.10` remain strings rather than becoming corrupted IDs.

🩺 Errors That Name the Line

Unsupported or malformed YAML fails loudly with the offending line number and a plain-English reason, instead of producing plausible-looking JSON that quietly disagrees with your source file.

🔒 No Upload, No Signup, No Ads

Conversion runs entirely inside your browser tab. Nothing is transmitted, nothing is stored server-side, and there is no account wall or ad network anywhere on the page.

📄 `.yaml` and `.yml` File Uploads

Load a manifest straight off disk with the toolbar's Upload action instead of pasting it — the file is read locally by the browser, never posted anywhere.

⌨️ Re-parses As You Edit

The JSON output updates on every keystroke, so fixing an indentation mistake and seeing the corrected structure is a single edit rather than a re-submit.

What YAML to JSON Conversion Actually Does

YAML to JSON conversion re-encodes a YAML document into the JSON data model without changing the data itself. Both formats describe the same three things — mappings, sequences and scalars — so a YAML mapping becomes a JSON object, a YAML block sequence becomes a JSON array, and plain scalars resolve to strings, numbers, booleans or null. The differences are surface syntax and features: YAML uses significant indentation, allows comments, and supports anchors, aliases, tags and multi-document streams, none of which exist in JSON. Conversion in this direction is therefore lossy in exactly one respect — comments and anchors have no JSON equivalent and are dropped — while the values themselves survive unchanged. Developers need the conversion because Kubernetes manifests, Docker Compose files, GitHub Actions workflows, Ansible playbooks and OpenAPI specifications are authored in YAML, but the APIs, JSON Schema validators, policy engines and test fixtures that consume them expect JSON.

A few resolution rules are worth knowing before you trust the output. An empty value, `~`, `null`, `Null` or `NULL` all become JSON null; `0o755` and `0xFF` are read as octal and hexadecimal integers and emitted as their decimal values; a duplicate key resolves last-wins, exactly as JSON.parse treats a repeated JSON key; and anything quoted stays a string regardless of what it looks like, so `version: "1.0"` never collapses to the number 1. Keys are emitted verbatim — `runs-on` and `timeout-minutes` are not camel-cased or otherwise normalised — so the JSON stays a faithful, diffable representation of the file you pasted.

A Parser That Tells You Where It Stops

Most online converters present themselves as complete YAML implementations and stay quiet about the edges. This one is a deliberate subset, and says so up front: indentation-based maps, block sequences, quoted and plain scalars, comments, single-line flow collections and block scalars are supported; anchors, aliases, merge keys, tags, multi-document streams, explicit `? key` syntax and multi-line plain scalars are not. Every one of those unsupported constructs produces an explicit error naming the line — never a silent reinterpretation of your config. That trade is intentional: for infrastructure files, JSON that looks right but isn't is far more expensive than a conversion that refuses to run.

The privacy side of the trade is just as concrete. The files people convert on a page like this are Kubernetes Secret objects, Compose blocks with a database URL in environment:, and CI workflows that reference registry tokens. Pasting those into a server-side converter means handing a live credential to a third party whose logs you cannot inspect. Here the parse happens in your own tab — no upload, no request, no account — and because the whole project is open source you can read the parser rather than trust a claim about it: view the source on GitHub.

Once your YAML is JSON, the rest of the toolkit picks up where this page leaves off. Go the other way with the JSON to YAML converter, re-indent or inspect the result in the JSON formatter and tree viewer, check a hand-edited document with the JSON validator, or turn a converted OpenAPI fragment into a contract with the JSON Schema generator. Every one of them runs client-side, on the same terms as this one.

Frequently Asked Questions (FAQ)

Which YAML features are supported?

This is a deliberate, pragmatic subset of YAML rather than a full YAML 1.2 implementation. Supported: nested mappings by indentation, block sequences (including `- key: value` and sequences of maps), single- and double-quoted scalars, plain scalars, comments, a leading `---` document marker, single-line flow collections like `[a, b]` and `{a: 1}`, and `|` / `>` block scalars with `-`, `+` or explicit-indent modifiers. Not supported, and rejected with an explicit error rather than silently mangled: anchors and aliases (`&base`, `*base`), merge keys (`<<:`), tags (`!!str`), multi-document streams, explicit `? key` syntax, tab indentation, multi-line plain scalars, and flow collections spread over several lines.

Why did my Kubernetes or Docker Compose file fail with an anchor error?

Because anchors, aliases and merge keys (`&defaults`, `*defaults`, `<<:`) are a YAML feature with no JSON equivalent — resolving them requires a full YAML implementation, and guessing at them would silently change your data. The converter stops and tells you the exact line instead. The fix is to inline the anchored block by hand, or run `helm template` / `docker compose config` first, which expands anchors and emits a flat, fully-resolved document that converts cleanly.

Do `yes`, `no`, `on` and `off` become booleans?

No — they stay strings. Scalar resolution follows the YAML 1.2 core schema, where only `true` / `false` (and their `True` / `TRUE` spellings) are booleans. This avoids the classic Norway problem, where a country code of `NO` in YAML 1.1 parsers silently becomes `false`. Numbers are equally conservative: a plain scalar becomes a JSON number only when it round-trips exactly, so version strings, zero-padded codes and long IDs are not quietly reformatted.

Is it safe to convert a Kubernetes Secret or a CI config here?

Yes. Parsing and JSON serialization happen inside your own browser tab — there is no upload step, no API call and no server that could log your document. That matters more for this conversion than most, because manifests, `.env`-style Compose blocks and CI workflow files routinely hold registry credentials, database URLs and API tokens. The project is also open source, so you can read the parser yourself instead of trusting a privacy policy.

Can I convert several YAML documents separated by `---` at once?

Not in a single pass. Multi-document streams — the common shape of a bundled `kubectl apply` manifest — are rejected with a message naming the line where the second document starts, because JSON has no equivalent of a document stream and the alternatives (returning only the first document, or silently wrapping them in an array) both misrepresent the input. Split the file on `---` and convert one document at a time. A single leading `---` marker is fine and is simply skipped.

How do I convert JSON back into YAML?

Use the JSON to YAML converter on this site, which runs the same conversion in the opposite direction. Round-tripping YAML → JSON → YAML preserves the data but not the presentation: comments, blank lines, quoting style and key ordering choices are properties of the YAML text, not of the data model, so they do not survive the trip through JSON.