jsonwebviewer
Convert

JSON to YAML

nothing is uploaded; conversion runs in this tab

A JSON object becomes a YAML mapping and a JSON array becomes a sequence, indented the way you'd hand-write it. A root path pulls a subtree out first if you only need part of the document.

What doesn't survive the round trip

JSON has no equivalent for YAML comments or anchors/aliases, so converting the other direction and back drops them. Structure and values survive; YAML-only syntax does not.

Related

Privacy

This page ships no analytics and sets no cookies. The content security policy blocks network requests, so your document cannot leave the tab.

Need a Kubernetes manifest, CI config, or docker-compose file in YAML from a JSON source — or the reverse? Convert either direction in one click, entirely in your browser.

Paste or open a JSON document, then choose YAML… from the Save menu to export it as a .yaml file, indentation and all. Going the other way is just as direct: choose YAML from the import-format dropdown in the Open menu to load a .yaml/.yml file (or paste YAML text directly) and get back valid JSON.

Nested objects and lists map the way you'd expect — a JSON object becomes a YAML mapping, a JSON array becomes a YAML sequence — so config structure survives the round trip intact.

Example — this JSON:

{
  "service": "billing-api",
  "replicas": 3,
  "env": {
    "NODE_ENV": "production",
    "LOG_LEVEL": "info"
  },
  "ports": [8080, 8443]
}

exports as this YAML:

service: billing-api
replicas: 3
env:
  NODE_ENV: production
  LOG_LEVEL: info
ports:
  - 8080
  - 8443

Open this example in the editor →
The link above pre-loads the config example above into Text mode. From there, open Save in the toolbar and choose YAML… to export it.

Frequently asked questions

Does converting between JSON and YAML upload my data anywhere?

No. Both directions run entirely in your browser — your document never touches a server.

Can I convert YAML back to JSON, not just JSON to YAML?

Yes. Open > choose YAML from the import-format dropdown to load a .yaml/.yml file (or pasted YAML text) and get it back as JSON.

Does it preserve comments or YAML-specific features like anchors?

No — JSON has no equivalent for YAML comments or anchors/aliases, so a round trip through JSON drops them. Structure and values survive; YAML-only syntax does not.

Working with newline-delimited records instead of a config file? See NDJSON Viewer.