json

FormatValidateConvert

YAML to JSON converter

Result· read-only

—JSON

The result appears here.

Convert

YAML to JSON converter.

Your document never leaves the browser.

YAML to JSON, read as YAML 1.2 — anchors and merge keys expanded, never uploaded.

Paste or drop a YAML file and get JSON back, with every value meaning what the YAML said — and a note for anything JSON cannot keep.

1.2

the YAML version it reads, so no stays no

0

digits lost from a 20-digit number

0

bytes leave your machine

Read as YAML 1.2, so no stays no

The reader follows the YAML 1.2 core schema. Only true and false (in lower, title or upper case) are booleans; null, Null, NULL, ~ and an empty value are null. So yes, no, on, off, y and n stay strings, and the country code NO is still NO — the “Norway problem” of YAML 1.1 does not happen here. Hexadecimal 0x and octal 0o integers are written as decimal without losing a digit.

1

The YAML

country: no
enabled: yes
verified: true
retries: ~
port: 0x1F90
2

The JSON it gives, at the default settings

{
  "country": "no",
  "enabled": "yes",
  "verified": true,
  "retries": null,
  "port": 8080
}

What converts, and what is noted

1

A compose file with an anchor and a merge key

x-base: &base
  restart: always
web:
  <<: *base
  image: nginx
2

The JSON it gives, and the notices under it

{
  "x-base": {
    "restart": "always"
  },
  "web": {
    "restart": "always",
    "image": "nginx"
  }
}
  • 1 alias expanded
  • Merge keys (<<) expanded — a YAML 1.1 feature

Converts

Every YAML style

Block and flow mappings and sequences, all five scalar styles, and literal and folded blocks with their chomping indicators.

Converts

Anchors and aliases

Anchors and aliases are expanded into copies, because JSON has no references; the result counts them.

Converts

Merge keys (<<)

Merge keys (<<), the YAML 1.1 feature docker-compose and GitLab CI rely on, are expanded, with a notice saying so.

Converts

Several documents

Several documents in one stream become a JSON array of documents, and the notice says how many.

Converts

Comments, tags and odd keys

Comments are dropped and counted. Tags such as !Ref or !!binary keep their untagged value and are listed. Keys that are not strings, like 1: or true:, are written as strings from their source text.

What is refused

Some YAML has no honest JSON equivalent, and the page says where rather than writing something close: a key that is itself a mapping or sequence, an alias to an anchor that contains it, an alias to an anchor that does not exist, a key repeated in one mapping, .inf and .nan as values, and tabs used for indentation. The error names the line and column and marks them in the source.

  • a key that is itself a mapping or sequence
  • an alias to an anchor that contains it
  • an alias to an anchor that does not exist
  • a key repeated in one mapping
  • .inf and .nan as values
  • tabs used for indentation

A key repeated in one mapping

name: web
port: 80
name: api

✕ Line 3, column 1: Duplicate key "name" — YAML 1.2 forbids it

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 →
Are large numbers rounded?

No. A number is copied into the JSON as it was written, so an 18- or 20-digit identifier survives. Nothing on the way passes through a JavaScript number.

Can I keep my comments?

Not in JSON, which has no comments. The result counts how many were dropped, so you know before you replace the file.

How is the JSON indented?

At the indent in Settings ⚙ — 2, 3 or 4 spaces, or a tab.

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.