plain/devtools home

YAML to JSON

YAML mappings become JSON objects, dashed lists become arrays, and bare words are typed: 8080 is a number, false a boolean. The conversion is lossless for data; comments and anchors are dropped.

Last reviewed 2026-11-04.

yaml-jsonsamplesCtrl↵ run · s sample · c copy
converts as you type

Supported: block maps and lists, flow [ ] and { }, quoted and plain scalars, | and > blocks, comments. Not supported: anchors, aliases, tags, merge keys, multi-line quoted or flow values and multiple documents. These are reported as errors, never silently changed.

never leaves your browser

Worked example

$ name: web
port: 8080
tags:
  - a
  - b
debug: false
version: 1.10
country: NO

becomes

{
  "name": "web",
  "port": 8080,
  "tags": [
    "a",
    "b"
  ],
  "debug": false,
  "version": 1.1,
  "country": "NO"
}

Gotchas

  • version: 1.10 is the number 1.1 in YAML. Quote it ("1.10") to keep the trailing zero.
  • country: NO is the string "NO" in YAML 1.2, which this tool follows. YAML 1.1 parsers (older PyYAML, many Ruby tools) read it as boolean false.
  • Indentation is the structure, and tabs are not allowed for it.
  • Comments (# note) have no JSON equivalent and are lost on conversion.

JSON to YAML

The reverse works the same way. {"a":[1,2],"b":{"c":null}} becomes:

$ a:
  - 1
  - 2
b:
  c: null

Running this on a server

YAML and JSON config files usually end up on a server or in CI. The hosting guide compares places to run small services.

Frequently asked questions

Is YAML a superset of JSON?

Since YAML 1.2, valid JSON is valid YAML, so a JSON file parses as YAML.

Why did my value change type?

Unquoted scalars are typed by their look: 1.10 is a number, true a boolean, null a null. Quote it to force a string.

Are comments kept?

No. JSON has no comments.

Sources

Related

esc
↑↓ move↵ open? all shortcuts

Keyboard shortcuts

Cmd or Ctrl shortcuts always work.
Everywhere
Everywhere
Open the command palette
CtrlK
Open the palette (outside a text field)
/
Show these shortcuts
?
Toggle light and dark theme
t
Go home
gh
Go to all tools
gt
On a tool page
On a tool page
Run the main action
Ctrl↵
Copy the output
c
Load the next sample
s
Focus the input
i
Leave a text field
Esc
Previous or next tool
[]
In the palette
In the palette
Move the selection
↑↓
Open the selected item
↵
Close
Esc