YAML to JSON Converter

Convert YAML to JSON and JSON to YAML, bidirectionally, with key order preserved and multi-document YAML support.

Direction:
Input (YAML)
Loading editor…
JSON Output
Loading editor…
Size: 0 bytesLines: 0

Related Tools

Learn more about the YAML to JSON Converter

YAML to JSON and JSON to YAML, One Tool

YAML and JSON represent the same kind of data — objects, arrays, strings, numbers, booleans, and null — in two different syntaxes. YAML is a strict superset of JSON in flow style, which means the conversion between them is lossless for ordinary data: every JSON document is already valid YAML, and any YAML document without YAML-only features like anchors, aliases, or comments converts to JSON with nothing left out.

This tool converts in both directions from a single page. Switch to YAML → JSON to parse YAML with js-yaml and pretty-print it as JSON, or switch to JSON → YAML to parse JSON natively and dump it as clean, indented YAML. Key order is preserved in both directions — nothing sorts your keys — so round-tripping a document gets you back the same structure you started with.

Multi-document YAML files — the ---separated format Kubernetes manifests commonly use to bundle several resources in one file — convert to a JSON array, one entry per document. Converting a plain JSON array back always produces a single YAML document containing a list, since a top-level array can't be reliably told apart from genuine multi-document YAML once it's JSON — this keeps the conversion predictable instead of guessing at document boundaries that may never have existed.

Paste YAML or JSON — or drag and drop a file — and the conversion runs instantly as you type, entirely in your browser. Nothing is uploaded to a server.

Why Convert Between YAML and JSON?

Move Between Config Formats

Kubernetes manifests, CI configs, and API payloads increasingly live in both YAML and JSON across a toolchain. Converting between them by hand is slow and easy to get wrong.

Debug with the Format You Know

JSON is easier to diff, grep, and feed into scripts and jq pipelines; YAML is easier to hand-edit. Converting lets you work in whichever is more convenient for the task at hand.

Feed YAML Into JSON-Only Tools

Many APIs, linters, and JSON Schema validators only accept JSON. Converting a YAML config first lets you use them without maintaining a second copy by hand.

Round-Trip Without Losing Order

Key order affects readability and, in some tools, behavior. This converter never sorts keys, so converting there and back reproduces the same order you started with.

Example

The same data, in both formats — nested objects, arrays, and scalar values convert cleanly in either direction.

YAML
apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
  labels:
    app: web
spec:
  replicas: 3
  template:
    spec:
      containers:
        - name: web
          image: nginx:1.25
          ports:
            - containerPort: 80
JSON
{
  "user": {
    "id": 42,
    "name": "Jane Doe",
    "active": true,
    "roles": ["admin", "editor"],
    "address": {
      "city": "London",
      "country": "UK"
    }
  }
}

Features

Bidirectional Conversion

Convert YAML to JSON or JSON to YAML from the same page — just switch direction.

Key Order Preserved

Keys keep their original order on the way over and on the way back, since nothing sorts or reorders them.

Multi-Document YAML

A ---separated YAML file converts to a JSON array — one entry per document.

Upload a File

Drag and drop or upload a .yaml/.yml or .json file depending on the direction.

Copy / Download Output

Copy the result or download it as a standalone .json or .yaml file.

Clear Error States

Invalid YAML and invalid JSON are reported separately and labeled for whichever direction you’re converting.

How to use

Paste your input in the left editor. The output appears automatically on the right. Use the toolbar buttons to copy, download, or transform the result.

  1. Paste or type your content in the input editor on the left.
  2. The formatted output is generated automatically.
  3. Use Copy, Download, or other actions from the output toolbar.
  4. Click the expand icon to view the output in fullscreen.
FAQ

Is this YAML/JSON converter free?

Yes, the converter is completely free to use with no limits, signup, or account required.

Is my data uploaded to a server?

No. All conversion happens entirely in your browser using JavaScript. Your YAML and JSON are never uploaded or sent to a server.

Does it convert in both directions?

Yes. Switch between YAML → JSON and JSON → YAML with the direction toggle above the editor — both run on the same page.

Does it preserve key order?

Yes. Neither direction sorts or reorders keys, so converting a document there and back reproduces the same key order you started with.

Does it support multi-document YAML files?

Yes. A ---separated YAML file with multiple documents converts to a JSON array, one entry per document — useful for Kubernetes manifests that bundle several resources in one file.

If I convert a JSON array to YAML, do I get multiple documents back?

No — a JSON array always converts to a single YAML document containing a list. A top-level JSON array can't be reliably told apart from genuine multi-document YAML once it's JSON, so this converter never guesses at document boundaries that may not have existed in the first place.

What happens if my input is invalid?

Invalid YAML and invalid JSON are reported as separate, clearly labeled error states depending on which direction you’re converting, with the parser’s own error message shown inline.

Can I upload a file instead of pasting?

Yes. Drag and drop or use the upload button to load a .yaml/.yml file (when converting YAML → JSON) or a .json file (when converting JSON → YAML).

Can I download the converted output?

Yes, use the Download button to save the result as a standalone .json or .yaml file.