DataShift

Convert YAML to JSON Online

Parse Kubernetes manifests, Docker Compose files, CI/CD configs, and any YAML into clean JSON. Anchors, aliases, and multi-document YAML all handled.

YAML → JSON

Free YAML to JSON converter. Paste any YAML — Kubernetes manifest, Docker Compose, GitHub Actions, OpenAPI spec — and get formatted JSON. Handles anchors, aliases, and multi-document files. Works in your browser.

100% local — no uploads
Input · YAML

Output will appear here

How to use the YAML → JSON

  1. Paste or upload your YAML data

    Paste text directly into the input box, drag and drop a file onto it, or click "Upload file" to browse. Conversion starts instantly on paste — no button click required.

  2. Configure options (optional)

    Open the Options panel to customise delimiter, headers, nested-object flattening, and more. Use the Field Selector to pick exactly which columns appear in the output.

  3. Copy or download your JSON

    Click Copy to grab the result, or Download to save the file. Everything runs locally in your browser — no data ever leaves your device.

Example

Input (YAML)

- id: 1
  name: Alice

Output (JSON)

[
  { "id": 1, "name": "Alice" }
]

Frequently Asked Questions

Is my data safe?
Yes. Every conversion runs entirely inside your browser. No data is ever transmitted to a server. The tool works offline once loaded.
What is the maximum file size?
There is no hard limit. Files under 1 MB convert instantly. Files 1–10 MB show a progress indicator. Files over 10 MB prompt a warning and run in a background thread to keep the browser responsive.
Why does my YAML fail to parse?
Common causes are trailing commas, single-quoted strings, unquoted keys, or missing closing brackets. The converter auto-repairs many of these and tells you exactly what it changed.
Can I convert multiple files at once?
The tool handles one file at a time. For bulk conversion, consider the csvjson CLI or API.

How it works

Step 1

Anchors and aliases are fully resolved

YAML anchors (&name) and aliases (*name) are expanded in the JSON output — you get the full value at every reference point, not a reference token. JSON has no equivalent concept.

Step 2

Multi-document YAML files

A single YAML file can contain multiple documents separated by ---. Common in Kubernetes (one file for Deployment + Service + ConfigMap). Each document becomes an element in a JSON array.

Step 3

YAML types map to JSON types

YAML booleans (true/false/yes/no/on/off), nulls (~), integers, and floats all become their JSON equivalents. Quoted YAML strings stay strings — no silent type coercion.

Example

Kubernetes Deployment manifest parsed for a policy validation script

Input
apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-server
  labels:
    app: api
    env: production
spec:
  replicas: 3
  selector:
    matchLabels:
      app: api
  template:
    spec:
      containers:
        - name: api
          image: node:18
          ports:
            - containerPort: 3000
Output
{
  "apiVersion": "apps/v1",
  "kind": "Deployment",
  "metadata": {
    "name": "api-server",
    "labels": { "app": "api", "env": "production" }
  },
  "spec": {
    "replicas": 3,
    "selector": { "matchLabels": { "app": "api" } },
    "template": {
      "spec": {
        "containers": [
          { "name": "api", "image": "node:18",
            "ports": [{ "containerPort": 3000 }] }
        ]
      }
    }
  }
}

JSON output is ready for jq queries, policy engines (OPA/Rego), or any tool that reads JSON but not YAML.

Edge cases, handled

YAML booleans: yes/no/on/off

YAML 1.1 treats yes, no, on, off as booleans. If your config uses these as string values, quote them in the YAML source. The converter reports any automatic boolean coercions.

Tabs in indentation

YAML strictly forbids tabs for indentation — only spaces are valid. If your file uses tabs, the parser reports the exact line number. Replace tabs with 2 or 4 spaces.

Duplicate keys

YAML allows duplicate keys in a mapping; JSON does not. When duplicate keys are detected, the last value wins and a warning is shown.

Frequently asked questions

My YAML uses tabs instead of spaces. Will this break parsing?

Yes — YAML strictly forbids tabs for indentation. The parser reports the exact line and column of the first tab character. Replace tabs with 2 or 4 spaces (most editors have a setting to do this automatically).

I have a Kubernetes manifest with multiple resources (---). How does the output look?

Each --- separator produces a separate JSON object. A file with a Deployment, a Service, and a ConfigMap becomes a JSON array of three objects. You can then use jq or a loop to process each resource separately.

Why does 'yes' in my YAML become true in JSON?

YAML 1.1 (the most widely used version) treats yes, no, on, off, true, false as booleans. This is a known YAML quirk. If you need 'yes' as a string, quote it in the source: yes: 'yes'. The converter warns you when this coercion happens.

Does this handle GitHub Actions workflow files?

Yes. GitHub Actions workflows are standard YAML. The 'on' key (workflow trigger) is a YAML boolean in older parsers, but js-yaml handles it correctly as a string key. The converted JSON is accurate.

I want to query a Kubernetes manifest with jq. Can I use this?

Exactly the use case. Paste your manifest, get JSON, then use jq to extract fields: jq '.spec.replicas' or jq '.metadata.labels'. This is much faster than writing a custom YAML parser.