All guides

How to convert YAML to JSON (nested keys, lists, and the gotchas)

Convert YAML to JSON correctly, including nested maps, lists, and multi-line strings, right in your browser, with nothing uploaded.

YAML and JSON describe the same data model, so converting between them is usually clean, until nested structures and YAML's friendlier syntax trip you up. Here's what actually maps, and how to convert safely.

The mental model

YAML is a superset of JSON: every JSON document is valid YAML. Converting YAML to JSON mostly means making the structure explicit.

YAML Becomes JSON
key: value "key": "value"
Indented block Nested object { ... }
- item list Array [ ... ]
true / 42 Real boolean / number

The gotchas

  • Indentation is structure. A single wrong space changes nesting. If your output looks flat when you expected nesting, check the indentation.
  • Unquoted strings that look like other types. version: 1.10 becomes the number 1.1; country: NO can become false. Quote them ("1.10", "NO") if they must stay strings.
  • Multi-line strings (| and >) collapse into a single JSON string, with or without newlines. Know which one you want.

Convert it privately

Drop's YAML to JSON tool parses YAML in your browser and shows the JSON as you type. Nested maps and lists are preserved, and nothing is uploaded.

  1. Paste your YAML (or upload a .yaml / .yml file).
  2. Read the JSON on the right. It updates live.
  3. Copy it, or download a .json file.

Need the other direction? Use JSON to YAML.

Convert YAML to JSON here

Try the tool

Do it now — free, in your browser, nothing uploaded.

Open YAML to JSON