YAML to JSON converter

Convert between YAML and JSON both ways

Runs in your browser. Nothing is uploaded.

How it works

YAML and JSON can hold the same data. YAML is easier to read, so it’s common in config files, and JSON is what most programs and APIs exchange. Paste either one to convert it. We follow anchors, turn multi-document YAML into a list, and name the line of any error. It all runs in your browser.

Read the text into a tree, then write the same tree in the other format.

We read your text into a tree of data, then write that tree in the other format. Comments in YAML aren’t carried over, because JSON has none.

Worked example. The YAML line “name: Asha” becomes {"name": "Asha"} in JSON. Indentation in YAML becomes nesting in JSON.

Advertisement

Examples

YAMLJSON
a: 1{"a": 1}
- x["x"]
ok: true{"ok": true}

What this tool doesn’t cover

  • YAML comments are lost, because JSON can’t hold them.
  • JSON to YAML uses standard number parsing, so very large integers may round. Use the JSON formatter if those matter.

Questions

What happens to YAML anchors?

They’re followed, so the JSON has the full value in each place.

What about several documents in one file?

They become a JSON array, with one item for each document.

Is my data uploaded?

No. Everything runs in your browser.

What is the difference between YAML and JSON?

Both hold structured data. YAML uses spaces and is easy to read, while JSON uses brackets and is easy for programs.

Why does my YAML fail to parse?

The usual cause is mixed tabs and spaces, or uneven indents. YAML needs spaces only.

Advertisement

Was this useful?

Built by QuickToolz.

Sources: YAML 1.2 specification (opens in a new tab)

Submit ProductLoginAccountBlogAdvertise