JSON to YAML Converter

Data Tools

Paste JSON and get readable YAML, with values that older YAML readers would misread quoted automatically.

Options
JSON
YAML

Processed in your browser. A copy of each run is saved to your past runs so you can reopen it. Privacy

About

What the JSON to YAML Converter does

The JSON to YAML Converter rewrites a JSON document as clean, block-style YAML. You choose the indent, whether strings are quoted only when needed or always, the line width and whether short arrays stay on one line. Strings such as no, on or 0123, which some YAML readers would turn into booleans or numbers, are quoted automatically. Key order is kept unless you sort.

Steps

How to use it

  1. 1Paste JSON, upload a .json file, or open a link with ?json= in it.
  2. 2Pick the indent, quoting and line width.
  3. 3Press Convert, then copy or download the .yaml file.

Example

A real run

Input

{
  "name": "storefront",
  "version": "2.3.0",
  "private": true,
  "scripts": {"dev": "next dev", "build": "next build"},
  "engines": {"node": ">=20"},
  "keywords": ["shop", "no"]
}

Output

name: storefront
version: 2.3.0
private: true
scripts:
  dev: next dev
  build: next build
engines:
  node: ">=20"
keywords:
  - shop
  - "no"

Key order is kept and only the values that need it are quoted: >=20, because > starts a folded string in YAML, and "no", which YAML 1.1 readers would turn into false.

Options

Every setting, and when to use it

Indent and line width
2 spaces is the convention for Kubernetes, Ansible and GitHub Actions. Long strings fold at 80 or 120 characters for readability, or never fold so each value stays on one line for diffs.
Quotes
Only when needed writes name: storefront and quotes just the values that require it. Always on strings quotes every string value, which some teams prefer for config that non-developers edit.
Short arrays on one line
Writes small lists of short scalars as [a, b, c], the way many hand-written files do. Long or nested lists stay in block style.
Sort keys
Orders keys alphabetically at every level, so two files are easier to compare. Off keeps the original order, which usually reads better.

Good to know

Common problems and limits

Input up to 5 MB of JSON. The output is YAML 1.2 that YAML 1.1 readers also read correctly.

JSON has no comments, anchors or multi-line string styles, so the YAML has none either; add comments by hand after converting.

To go back, use YAML to JSON; to check hand-edited YAML for mistakes, use the YAML Validator.

Audience

Who uses it

  • DevOps engineersTurn JSON output from kubectl, Terraform or a cloud CLI into YAML that fits a manifest or a Helm values file.
  • API developersConvert an OpenAPI or Swagger document from JSON to YAML, which is easier to review and comment in pull requests.
  • DevelopersMove a package.json-style config, a fixture or test data into YAML for a framework that expects it.

FAQ

Frequently asked

Why do some strings get quotes in the YAML?

Values such as no, on, yes, off, 0123 and 1e3 look like booleans or numbers to some YAML readers, especially older YAML 1.1 tools, so they are quoted to stay strings. Everything else is written plain. The status line tells you how many values were quoted.

How do I convert an OpenAPI or Swagger file from JSON to YAML?

Paste the JSON document and press Convert; the structure, key order and $ref values are kept. Most API tools accept either format, so the YAML version is mainly for people who review and edit the spec.

Can I use the YAML for a Kubernetes manifest?

Yes. kubectl accepts JSON and YAML, and the converted YAML is equivalent. Convert the output of kubectl get ... -o json, remove status and server-set metadata, and the result can be applied again.

How do I convert JSON to YAML on the command line?

With yq version 4: yq -P file.json, or yq -o=yaml file.json. In Python with PyYAML: yaml.safe_dump(json.load(f), sort_keys=False). Python's dump does not quote no and on the same way, so check those values.

Does converting change my data?

No. Keys, values and types are the same; only the syntax changes. Converting the YAML back with YAML to JSON gives the original data.

Is my JSON sent anywhere?

No. It is converted in your browser with the open-source yaml library. A copy of each conversion is saved to your past runs so you can reopen it.

Automation: an MCP tool json_to_yaml(json, options) → yaml and an n8n node are planned for this tool.

All data tools →
GuideJSON, YAML, TOML and XML: which format when →When to use JSON, YAML, TOML or XML: what each is good at, the traps (YAML's no, JSON's big numbers, XML attributes) and how to convert between them.
Built and maintained by Radhika SinghLast updated Questions: hello@operativez.ai