json

FormatValidateConvert

JSON to YAML converter

Result· read-only

—YAML

The result appears here.

Convert

JSON to YAML converter.

Your document never leaves the browser.

JSON to YAML that PyYAML and Kubernetes read back correctly — in your browser.

Paste JSON and get YAML that means the same thing to whatever reads it next, including the older YAML 1.1 parsers most tooling still uses.

1.1

readers get the same values back: PyYAML, go-yaml v2

0

values, keys or number texts changed on the round trip

0

bytes leave your machine

Written for 1.1 readers too

The page reads YAML as 1.2, but the YAML it writes lands in PyYAML, go-yaml v2 and older Kubernetes tooling, which read 1.1. So any string either version would read as something else is quoted: yes, no, on, off, y and n in every case; ~ and null; number-like text such as 012, 1_000, 1:20 and 0b101; dates like 2001-12-14; .inf and .nan; and anything starting with a YAML indicator or carrying leading or trailing spaces.

A string with line breaks is written as a literal block (|) with the right chomping indicator, so it reads back exactly.

1

The JSON

{
  "country": "no",
  "enabled": true,
  "version": "012",
  "released": "2001-12-14"
}
2

The YAML it gives, at the default settings

country: "no"
enabled: true
version: "012"
released: "2001-12-14"

Options and notices

1

A top-level array of two services

[
  { "name": "web" },
  { "name": "api" }
]
2

The YAML with One YAML document per array element on

---
name: web
---
name: api

Notice

One document per element

One YAML document per array element: a top-level array becomes a stream of documents separated by ---. A one-element array written that way reads back as its element, and the result says so.

Notice

Exponent numbers

Numbers in exponent form, like 1e5, are kept as written; YAML 1.1 readers such as PyYAML read them as strings, and the result warns you.

Notice

Lone surrogates

A string holding a lone surrogate is written, with a notice that other YAML readers may reject it.

Lossless on data

JSON to YAML and back gives the same values, the same key order and the same number text. Indentation follows Settings ⚙; YAML cannot indent with tabs, so a tab setting writes 2 spaces.

Press ⇄ to read the YAML back on the same page: it becomes the source, and the JSON it gives is the result, so you can check the round trip before you commit the file.

1

The first example’s YAML, read back with ⇄

country: "no"
enabled: true
version: "012"
released: "2001-12-14"
2

The JSON it gives: the one it was written from, byte for byte.

{
  "country": "no",
  "enabled": true,
  "version": "012",
  "released": "2001-12-14"
}

Private by construction

The conversion runs in your browser, in the same engine the editor uses. The document is never uploaded, never logged and never leaves your machine — there is no server to send it to. Once the page has loaded it keeps working with the connection off.

Going the other way?

FAQ

Frequently asked questions

Didn’t find your answer?Write to us on the contact page →
Why are some of my strings quoted?

Because unquoted they would change type in some reader. "no" unquoted is false to YAML 1.1, and "012" is the number 10. Quoting keeps them strings everywhere.

Does the key order change?

No. Keys are written in the order the JSON has them.

My JSON has an error. What happens?

Nothing is written. The status bar gives the line and column of the first error, and the source marks it.

Keyboard shortcuts

Send feedback

Questions, bug reports and feature requests are all welcome. A bug report is easiest to act on with the shape of the document that caused it — never send anything confidential.

Email us

Contact page, in a new tab, so this page stays as it is.

Settings

Indent

The result is written with it — YAML and XML at 2 spaces when it is Tab.

Code text size
14 px

Both panes.

Wrap long lines

Load from a URL

Your browser fetches it directly — the request goes to that site, never to us.