Skip to content
Free developer tool

JSON to YAML converter

This JSON to YAML converter turns a JSON document into readable block-style YAML 1.2. Developers use it to write Kubernetes manifests, CI pipelines, Docker Compose files and app config from existing JSON.

  • Runs in your browser
  • Free, no account needed
  • Copy or download the result
Private: runs on this device

Input

118 characters

Result

name: web
replicas: 3
enabled: "yes"
ports:
  - 80
  - 443
env:
  MODE: production
  NOTE: |
    line one
    line two

Example

Input
{"name":"web","replicas":3,"enabled":"yes","ports":[80,443],"env":{"MODE":"production","NOTE":"line one\nline two\n"}}
Result
name: web
replicas: 3
enabled: "yes"
ports:
  - 80
  - 443
env:
  MODE: production
  NOTE: |
    line one
    line two

How to use the json to yaml converter

  1. Paste your JSON into the JSON box.
  2. Pick an Indentation: 2 spaces or 4 spaces.
  3. Press Run.
  4. Use Copy result or Download to save the YAML.

How it works

Objects become key: value lines and arrays become - items, in the same order as your JSON.

Strings that YAML could misread, such as yes, no, on, null, numbers, dates, empty text or text with leading or trailing spaces, are put in double quotes.

Multi-line strings become literal blocks (|), using |- or |+ when needed to keep the exact line endings.

Numbers keep their exact digits, so large integers are not rounded.

Invalid JSON is rejected with the line and column of the problem, and an object with the same key twice is rejected because YAML needs unique keys.

Everything runs in your browser. Your input is not uploaded or stored.

Questions and answers

Why are some values in quotes?

YAML reads some plain words as other types. Without quotes, yes or on can become true and 1.5 becomes a number, so the converter quotes them to keep them as text.

Which YAML version does the output follow?

The output is YAML 1.2 block style. It also quotes words such as yes and off that older YAML 1.1 parsers treat as booleans, so it reads the same in both.

Does it keep the order of my keys?

Yes. Keys appear in the same order as in your JSON, including keys that look like numbers.

Is my JSON uploaded?

No. It runs in your browser, and nothing you paste is sent to a server.

All 220 SnowRock tools