YAML to JSON Converter

Paste YAML below to convert it to JSON instantly. Everything runs in your browser.

YAML Input
JSON Output

        

Why convert YAML to JSON?

YAML is great for human-edited configuration, while JSON is the standard for APIs, data interchange and programmatic processing. Converting YAML to JSON lets you feed config files to APIs, validate them against a schema, or inspect their exact structure.

Example conversion

YAML

server:
  host: localhost
  port: 8080
database:
  name: app
  replicas:
    - db1
    - db2

JSON

{
  "server": { "host": "localhost", "port": 8080 },
  "database": {
    "name": "app",
    "replicas": ["db1", "db2"]
  }
}

Supported YAML features

YAMLJSON result
Mappings (key: value)Objects
Sequences (- item)Arrays
Inline arrays ([a, b])Arrays
Multi-line strings (| and >)Strings with line breaks
true / falseBooleans
null / ~null
Anchors and aliases (&a / *a)Expanded values

Common use cases

  • API integration — send a YAML config as a JSON request body
  • Kubernetes debugging — see the exact structure of a manifest
  • Config validation against a JSON Schema
  • Data processing in languages with built-in JSON support
  • Generating JSON examples for documentation

YAML gotchas

  • The Norway problem: in YAML 1.1 values like NO and YES are read as booleans. Quote them if you mean text.
  • Numbers: 1.0 becomes the number 1, not the string "1.0"; a zip code such as 01234 may be read as octal. Quote ambiguous values.

Programmatic conversion

// Node.js (js-yaml)
const yaml = require('js-yaml');
console.log(JSON.stringify(yaml.load(text), null, 2));

# Python (PyYAML)
import json, yaml
print(json.dumps(yaml.safe_load(text), indent=2))

# Command line (yq)
yq -o=json file.yaml

Pro tips

  • YAML is whitespace-sensitive — check your indentation if parsing fails.
  • JSON doesn't support comments, so YAML comments are dropped.
  • Run the result through a JSON validator to double-check it.

Related tools

JSON to YAML · JSON Validator · JSON Diff