Menu

Language

Units

Changes the symbol and formatting. It does not convert amounts.

Theme

Suggest a tool

JSON to YAML converter

Paste the JSON and out comes the YAML. We quote the strings YAML would read as a boolean or a number, which is where nearly every surprise comes from.

Code Formats and data No sign-up

Your figures

Converted in your browser. Nothing is sent to a server.

Result

YAML
service: api
port: 8080
active: true
countries:
  - ES
  - 'NO'
limits:
  rpm: 600
Lines
8
Size (bytes)
82
Difference from the JSON
-6.8%

What we assume

  • The conversion happens in your browser. The JSON never leaves your machine.
  • It produces YAML 1.2 with a two-space indent, which is what Kubernetes, Docker Compose and GitHub Actions expect.
  • Strings YAML would read as something else —no, yes, off, 08001— are always quoted. A spare quote beats a changed value.
  • Key order is preserved. YAML gives it no meaning, but the person reading it does.
  • The conversion goes one way: JSON to YAML. YAML supports things JSON cannot represent, such as anchors and references.

How it is calculated

The JSON is parsed by the browser engine and written back out in YAML syntax: two spaces per level, a dash for list items, a colon for keys. The interesting part is not that — it is knowing when to add quotes.

The Norway problem

YAML 1.1 reads no, n, off and false as boolean false. So an unquoted list of country codes turns Norway — NO — into false. It is a real bug, a famous one, and hard to spot, because the file is still valid YAML.

Postcodes have the same problem: unquoted, 08001 is read as the number 8001 and loses its leading zero. That is why anything that could read as a boolean, number, null or date gets quoted here.

Multi-line text

When a string contains newlines we use the literal block |- rather than filling it with . It reads better and it is what hand-written YAML does.

An example

With {"country":"NO","postcode":"08001"} the result is country: 'NO' and postcode: '08001', quoted. Without the quotes a YAML reader would hand back false and 8001: same file, different data.

Frequently asked questions

Can I convert YAML to JSON?

Not yet. Generating YAML is straightforward; reading it properly needs a full parser, with anchors, references and multiple documents per file. We would rather not offer it than offer half of it.

Why does it quote things I would not quote?

Because without the quotes the value would change type. YAML with spare quotes is ugly; YAML with missing quotes is wrong — and worse, it stays valid and says nothing.

Does it work for a Kubernetes manifest?

Yes: the two-space indent and list formatting are what Kubernetes, Docker Compose and GitHub Actions expect.

What about comments?

JSON has no comments, so there is nothing to carry over. If you want them in the YAML, add them afterwards with #.

Keep calculating

All tools →

Updated on 2026-09-02. Calculations run in your browser; nothing you type is sent to a server.

move · open · Esc close Missing one?