JSON to YAML Converter

Paste JSON and get clean YAML for Kubernetes manifests, Docker Compose, GitHub Actions or any config file. Both sides stay editable and in sync.

Runs in your browser
YAML indent
JSON indent
Open file

Both panes are editable — change either side and the other updates instantly.

Your data never leaves your computer. All processing happens 100% locally in your browser.

How to use the JSON to YAML

  1. Paste JSON into the JSON pane, open a .json file, or click Load sample.
  2. The YAML pane updates instantly. Pick a YAML indent of 2 or 4 spaces and optionally sort keys or quote every string.
  3. Edit the YAML directly if you like — the JSON side updates too.
  4. Click Copy or Download to save data.yaml.

What does a JSON to YAML converter do?

It parses a JSON document and re-serialises the same data as YAML. Because YAML 1.2 is a superset of JSON, every JSON value has an exact YAML equivalent: objects become mappings, arrays become sequences (- item), and strings, numbers, booleans and null stay the same type. The result is typically 20–40% shorter and far easier to read and edit by hand, which is why YAML is the standard for Kubernetes, Docker Compose, GitHub Actions, Ansible and OpenAPI specs.

Example

This JSON:

{
  "service": "api",
  "replicas": 3,
  "ports": [8080, 9090],
  "env": {"LOG_LEVEL": "info"}
}

becomes this YAML:

service: api
replicas: 3
ports:
  - 8080
  - 9090
env:
  LOG_LEVEL: info

How strings are quoted

The converter (powered by the widely used js-yaml library) only adds quotes where they are needed to keep the value a string. Values like "yes", "on", "123", "null" or "2024-01-01" are quoted because an unquoted yes would be read as a boolean by YAML 1.1 parsers (the famous “Norway problem”, where the country code NO turns into false). Strings containing : , # or leading spaces are also quoted. Multi-line strings are written as literal block scalars (|-) so line breaks stay readable. Enable Quote all strings if a downstream tool expects every string quoted.

JSON vs. YAML at a glance

JSONYAML
CommentsNot allowed# comment
StructureBraces and bracketsIndentation
QuotesRequired on keys and stringsUsually optional
Multi-line strings\n escapesBlock scalars | and >
ReuseNoneAnchors & and aliases *
Best forAPIs, data exchangeHuman-edited config

Tips for config files

Indentation in YAML must use spaces, never tabs. Two spaces is the convention for Kubernetes and most CI systems. After converting, you can add comments to explain settings — something JSON cannot hold. To go the other way, use the YAML to JSON converter; to tidy the JSON first, run it through the JSON Formatter.

Tools that pair well with the JSON to YAML

  • JSON to CSV — Turn a JSON array into a spreadsheet-ready CSV.
  • JSON to TypeScript — Paste a JSON sample — an API response, a config — and get ready-to-use TypeScript interfaces with nested types, optional properties and union types.
  • CSV to JSON — Paste CSV or TSV and get a JSON array of objects.
  • JSON to Markdown Table — Turn API responses or LLM-generated JSON arrays into a clean, aligned Markdown table for READMEs, docs and pull requests.

Frequently asked questions

Is YAML a superset of JSON?
Yes, since YAML 1.2 (2009) any valid JSON document is also valid YAML. That is why the conversion is lossless: the data and types are identical, only the syntax changes.
Why are some of my strings quoted in the YAML output?
Strings such as "yes", "off", "0123" or "1.0" would be interpreted as booleans or numbers if left unquoted, so they are quoted to preserve them as strings.
Can I convert JSON to YAML for Kubernetes?
Yes. Paste the JSON output of kubectl get … -o json and you get YAML you can save as a manifest. Remove server-generated fields such as status, uid and resourceVersion before applying it again.
Is my data sent anywhere?
No. The conversion runs in your browser using the open-source js-yaml library; nothing is uploaded.

Related tools