plain/devtools home

YAML to JSON converter (and back)

Paste YAML to get JSON, or JSON to get YAML. Errors name the line. Nothing leaves your browser.

tool 09 of 12 []
all shortcuts ?

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

How to use it

  1. Paste YAML on the left and press YAML to JSON, or paste JSON on the right and press JSON to YAML.
  2. Scalars follow the YAML 1.2 core schema: true and false are booleans, null and ~ are null, and numbers become numbers. Quote a value ("true", "1.0") to keep it a string.
  3. Indentation must use spaces. YAML forbids tabs, and the tool reports the line if it finds one.
  4. Converting JSON to YAML quotes any string that would otherwise be read as a number, boolean or null, so a round trip returns the same data.

Examples

Select an example to load it into the tool.

  • Docker Compose styleservices: ↵ web: ↵ image: nginx:1.27 ↵ ports: ↵ - "8080:80" ↵ environment: ↵ DEBUG: false ↵ LEVEL: info # comment ↵
  • Block textdescription: | ↵ Line one ↵ Line two ↵ items: [a, b, {c: 1}] ↵
  • Duplicate key (error)a: 1 ↵ b: 2 ↵ a: 3 ↵
  • JSON input{"name":"demo","enabled":true,"ports":[80,443],"owner":null}

Frequently asked questions

Is this a complete YAML parser?

It handles the subset used by most configuration, CI and Kubernetes files. It deliberately rejects anchors (&), aliases (*), tags (!!), merge keys (<<), multi-line plain scalars and multi-document streams, and tells you the line, instead of producing wrong output. For those features use a full library such as PyYAML or js-yaml.

Why did "yes" and "no" become strings?

YAML 1.1 treated yes, no, on and off as booleans, which famously turns the country code NO into false. YAML 1.2 (and this tool) treats only true and false as booleans. When writing YAML, the tool quotes yes, no, on and off so older parsers still read them as strings.

Do comments survive conversion?

No. JSON has no comments, so YAML comments are dropped when converting to JSON and cannot come back.

Why are my large numbers quoted?

Integers beyond JavaScript's safe range (above 9007199254740991) cannot be represented exactly as numbers, so they are kept as strings to avoid silent rounding.

Is my config uploaded anywhere?

No. Parsing is done by code running in your browser tab, so secrets inside a config file stay on your machine.

Related tools

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