JSON to YAML Converter.

Convert JSON to clean, idiomatic YAML for Kubernetes, CI pipelines, and config files — with indent and quote-style control. Private and instant, in your browser.

No signup · No uploads · No file-size cap

YAML output

Convert JSON to YAML online — free and private

A JSON to YAML converter rewrites JSON as YAML, the human-friendly configuration format used across DevOps. Paste your JSON above, press Convert to YAML, and the tool emits clean, indented YAML. Because it runs client-side, you can convert JSON to YAML online without uploading configs or secrets to a server.

How to convert JSON to YAML in three steps

  1. Paste your JSON into the input, or click “Load sample”.
  2. Choose your options — indent width and quote style (minimal, single, or double).
  3. Convert and export — copy the YAML or download it as data.yaml.

What JSON to YAML conversion actually changes

YAML 1.2 is a superset of JSON, so your JSON is already valid YAML — the point of converting is readability. Braces, brackets, and most quotes disappear; structure is carried by indentation instead:

{
  "apiVersion": "apps/v1",
  "kind": "Deployment",
  "spec": { "replicas": 3, "template": { "spec": {
    "containers": [{ "name": "web", "image": "nginx:1.27" }]
  }}}
}

becomes:

apiVersion: apps/v1
kind: Deployment
spec:
  replicas: 3
  template:
    spec:
      containers:
        - name: web
          image: nginx:1.27

Same data, roughly half the punctuation — and now you can add comments, which JSON does not support at all.

Built for real config files

YAML powers Kubernetes manifests, GitHub Actions, GitLab CI, Ansible playbooks, and Docker Compose. This converter produces idiomatic output: minimal quoting so values stay clean, correct quoting when a string could be misread as a number or boolean, and literal block scalars for multiline text. Choose 2- or 4-space indentation to match your project's style.

Convert JSON to YAML in Python, Node, or the terminal

If you need this inside a script or pipeline rather than as a one-off, these are the standard approaches:

Python (PyYAML) — the two keyword arguments matter more than people expect:

import json, yaml

with open("data.json") as f:
    data = json.load(f)

with open("data.yaml", "w") as f:
    yaml.safe_dump(data, f, sort_keys=False, default_flow_style=False)

Without sort_keys=False, PyYAML alphabetises your keys — which scrambles a Kubernetes manifest. Without default_flow_style=False, you get inline {a: 1} maps instead of block style.

Command line (yq) — the quickest option in CI:

yq -P eval data.json > data.yaml      # mikefarah/yq
# or, with Python already installed:
python3 -c 'import sys,json,yaml; yaml.safe_dump(json.load(sys.stdin), sys.stdout, sort_keys=False)' < data.json

Node.js (js-yaml):

import yaml from "js-yaml";
import { readFileSync, writeFileSync } from "node:fs";

const data = JSON.parse(readFileSync("data.json", "utf8"));
writeFileSync("data.yaml", yaml.dump(data, { indent: 2, lineWidth: -1 }));

Set lineWidth: -1 or js-yaml wraps long strings at 80 columns, which quietly corrupts long image tags and URLs.

Common JSON to YAML problems (and fixes)

“My version number changed.” The classic YAML footgun: 1.10 parses as the number 1.1, and 3.0 becomes 3. This converter quotes values that would be misread, so "1.10" survives intact.

“My country code NO became false.” The Norway problem. Older YAML 1.1 parsers coerce yes, no, on, and off into booleans. Quoted output prevents it.

“My keys got alphabetised.” That is a PyYAML default, not YAML itself. This tool preserves your original key order.

“I need comments in the output.” JSON cannot store them, so nothing can invent them during conversion — add them to the YAML afterwards. This is precisely why teams convert to YAML for configs.

“My JSON will not parse.” Fix it first with the JSON repair tool or check it with the JSON validator.

Why use this JSON to YAML tool?

It is fast, ad-free, and 100% private, with no file-size cap — which matters more here than for most conversions, because Kubernetes manifests and CI configs routinely contain secrets, internal hostnames, and private registry paths that should never be pasted into a server-side tool. Need the reverse? Use the YAML to JSON converter. Related tools: JSON to XML, JSON to CSV, JSON formatter, and JSON diff for comparing two configs. Learn more in our guide on how to convert JSON to YAML.

FAQ

JSON to YAML, answered.

How do I convert JSON to YAML online?+

Paste your JSON into the converter above and press Convert to YAML. The tool emits clean, indented YAML you can use in config files, Docker Compose, Kubernetes manifests, and CI pipelines. Copy it or download a .yaml file. Everything runs in your browser.

Can I choose the indentation and quoting?+

Yes. Pick 2 or 4 spaces of indentation, and a quote style: Minimal quotes only when a value needs it, Single wraps strings in single quotes, and Double uses double quotes. Minimal produces the cleanest, most idiomatic YAML.

How are multiline strings handled?+

Multiline strings are emitted as YAML literal block scalars (the | style), which preserve line breaks and stay readable — instead of being escaped onto a single line.

Why convert JSON to YAML?+

YAML is the configuration language of DevOps — Kubernetes, GitHub Actions, GitLab CI, Ansible, and Docker Compose all use it. Converting a JSON config or API response to YAML makes it easier to read and edit by hand.

Is my data private?+

Yes. The conversion is 100% client-side, so your JSON is never uploaded or stored. It is safe for secrets, configuration, and private data, and there is no file-size cap.

Is YAML a superset of JSON?+

Yes — since YAML 1.2, every valid JSON document is also valid YAML. That means a YAML parser will happily read your JSON as-is. Converting to YAML is therefore about readability and idiom, not compatibility: you get comments, block scalars, anchors, and far less punctuation to maintain by hand.

What is the difference between .yaml and .yml?+

Nothing. They are the same format and every parser accepts both. The official recommendation is .yaml; .yml survives from the era of three-letter extensions. Kubernetes, Docker Compose, and GitHub Actions all read either, so pick one and be consistent across your repo.

Why did my version number turn into a string?+

Because YAML would otherwise misread it. A value like 1.10 parses as the number 1.1, and 3.0 becomes 3 — which silently breaks version pins. The converter quotes values that could be misinterpreted, so 1.10 stays exactly "1.10". The same guard applies to values like yes, no, on, off, and true, which older YAML parsers coerce into booleans.

Can I convert JSON to a Kubernetes manifest?+

Yes — that is the most common use of this tool. Paste the JSON form of a manifest and you get valid YAML you can kubectl apply. Because nothing is uploaded, it is safe to convert manifests containing secrets, internal hostnames, or private image registries, which is not true of server-side converters.