JSON to YAML converter

Convert JSON to YAML or YAML to JSON, and validate either.

Runs in your browser. Your input is not uploaded.

What it does

YAML is a superset of JSON that uses indentation instead of braces, and is common for Kubernetes manifests, CI pipelines and Docker Compose files. Converting JSON to YAML makes config readable; converting back lets you check what a YAML file really means.

Parsing uses the yaml library (YAML 1.2). Anchors, aliases, << merge keys and multiple documents separated by --- are supported.

How to use it

  1. Paste JSON or YAML and choose the direction.
  2. Read the converted output, or the error line if the input is invalid.
  3. Copy the result.

Example

Input
{"service":{"ports":[80,443],"tls":true}}
Output
service:
  ports:
    - 80
    - 443
  tls: true

Things to watch for

  • YAML 1.1 parsers (some older tools) read no, yes, on and off as booleans. YAML 1.2, used here, does not. Quote those values if the file is read by an older parser.
  • Comments in YAML are lost when converting to JSON, which has no comments.
  • Tabs are not allowed for indentation in YAML.

Questions

Is all JSON valid YAML?
Valid JSON is valid YAML 1.2, so YAML parsers read it directly.
Why did my value change type?
Unquoted values like 1.0, null or 2026-01-01 are read as numbers, null or strings according to YAML rules. Quote them to keep them as strings.
What happens to multiple documents?
A file with several --- documents converts to a JSON array, one element per document.
Are anchors expanded?
Yes. Aliases (*name) are replaced by the anchored value in the JSON output.