DevToolsmith

JSON to YAML Converter

Paste JSON to get clean, readable YAML for Kubernetes manifests, Docker Compose files, GitHub Actions or app config. Ambiguous strings are quoted automatically, so YAML 1.1 and 1.2 parsers read them the same way.

Runs 100% in your browser — nothing is uploaded

JSON
Tip: drop a file here332 chars · 332 bytes · 16 lines
YAML
261 chars · 261 bytes · 18 lines

Example: a Kubernetes ConfigMap

JSON
{
  "apiVersion": "v1",
  "kind": "ConfigMap",
  "metadata": {
    "name": "app-config"
  },
  "data": {
    "LOG_LEVEL": "info",
    "ENABLE_CACHE": "on",
    "COUNTRY": "NO",
    "FILE_MODE": "0644",
    "RELEASE": "1.10"
  }
}
YAML
apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
data:
  LOG_LEVEL: info
  ENABLE_CACHE: "on"
  COUNTRY: "NO"
  FILE_MODE: "0644"
  RELEASE: "1.10"

Every value under data must be a string for Kubernetes. Unquoted, on and NO would be read as booleans by YAML 1.1 parsers, 0644 as the octal number 420, and 1.10 as the number 1.1. The converter quotes all four, while info needs no quotes.

JSON vs. YAML at a glance

FeatureJSONYAML
CommentsNot allowed# comment
StructureBraces and bracketsIndentation
QuotesAlways double quotesOptional for most strings
Multi-line stringsEscaped \nBlock scalars | and >
ReuseNoneAnchors & and aliases *
Typical useAPIs, data exchangeConfig files, CI/CD, Kubernetes

Convert JSON to YAML on the command line

# yq (mikefarah/yq v4)
yq -P '.' config.json > config.yaml

# Python
python -c 'import sys, json, yaml; print(yaml.safe_dump(json.load(sys.stdin), sort_keys=False))' < config.json

Need the reverse? Use YAML to JSON. Working with Rust or Python packaging? Try JSON to TOML.

Frequently asked questions

How do I convert JSON to YAML?

Paste JSON into the tool above and the YAML appears instantly. Objects become indented key/value blocks, arrays become "- " lists, and strings are quoted only when needed. Use Download to save it as a .yaml file.

Is all JSON valid YAML?

Almost. YAML 1.2 is a superset of JSON, so you could paste JSON directly into most YAML files. Converting it to block-style YAML is still worth it: it is easier to read and diff, and it supports comments.

Why are some values like "no" or "0644" quoted?

In YAML 1.1, which is still used by PyYAML and many older tools, unquoted no, yes, on and off are booleans, 0644 is an octal number and 1.10 becomes the float 1.1. The converter quotes these strings so they stay strings in every parser. This is known as the "Norway problem", because the country code NO turned into false.

Can I convert JSON to YAML for Kubernetes or Docker Compose?

Yes. The output is standard YAML that kubectl, Helm and docker compose accept. Kubernetes ConfigMap and Secret values must be strings, which is exactly why the safe quoting matters there.

Does the converter keep key order?

Yes. Keys are written in the same order as in your JSON, so diffs against the original stay readable.