Skip to content

Developer · Tools

YAML ↔ JSON Converter

Convert YAML to JSON and JSON to YAML without losing structure.

Loading tool…

Runs locally in your browser. Your input is not uploaded or stored. You can verify this in your browser’s network panel.

What does this tool solve?

YAML is a human-friendly superset of JSON. Convert YAML configs to strict JSON, or JSON data to readable YAML — parsed with a real YAML parser, so errors point at actual syntax problems.

Continue with JSON Formatter & Validator, JSON ↔ CSV Converter

What examples should you start with?

YAML to JSON

Input
YAML
server:
  port: 8080
  hosts:
    - a
    - b
Output
JSON
{
  "server": {
    "port": 8080,
    "hosts": [
      "a",
      "b"
    ]
  }
}

JSON to YAML

Input
JSON5
{"debug":true,"tags":["x","y"]}
Output
YAML
debug: true
tags:
  - x
  - y

How does it work?

Conversion parses the input into a data tree and re-serializes it in the target format. YAML anchors and references are resolved during parsing.

Type coercion follows YAML 1.2 rules — yes/no stay strings in JSON output of this parser, while true/false and numbers become JSON booleans and numbers.

What are the edge cases and limits?

  • Multi-document YAML (--- separators) is rejected; convert one document at a time.
  • Comments are a YAML-only feature and are lost when converting to JSON.
  • Key order is preserved as written, but JSON objects are unordered by spec — do not rely on ordering semantically.
  • YAML 1.1 booleans (yes/no/on/off) are parsed by js-yaml's JSON-compatible schema as strings in some cases — quote them in YAML if they must stay strings.

Technical reference

Related tools