PrettyJSON Logo
PrettyJSON

Instantly clean, validate, and inspect web payloads

YAML Input
JSON Output

Waiting for YAML input

Paste YAML on the left or load the sample to see JSON instantly.

100% Client-Side & Private

Convert YAML to JSON Online

Convert YAML — Kubernetes manifests, CI workflows, Docker Compose files, or any config — into formatted JSON. PrettyJSON parses the YAML with js-yaml, resolving nested maps, sequences, and anchor references, then pretty-prints the result with 2-space indentation. It is what you reach for when a tool or API needs JSON but your source of truth is YAML, and it runs fully in the browser.

Anchors and aliases expanded

&anchor and *alias references resolve to their concrete values, so the JSON holds fully materialized data with nothing left to dereference.

Mind the type coercion

Unquoted 3.10 is read as the number 3.1 and leading zeros can drop — quote any value you need kept verbatim.

Invalid YAML is pinpointed

A bad indent, a stray tab, or an unclosed quote is reported with the line it failed on, not a silent empty result.

How to convert YAML to JSON

A quick walkthrough and the details that matter.

Steps

  1. Paste valid YAML, or upload a .yaml / .yml file.
  2. The equivalent, indented JSON appears instantly on the right.
  3. Copy the JSON or download it as a .json file.

Anchors, aliases, and nested structures

YAML features that do not exist in JSON are resolved during parsing. Anchors (&name) and aliases (*name) are expanded into their concrete values, so the resulting JSON contains the fully materialized data with no references left behind. Nested mappings become nested objects and sequences become arrays.

Common gotchas when converting YAML

A few YAML behaviors surprise people. Unquoted values are coerced by type, so 3.10 becomes the number 3.1 and a leading-zero value may be read as a number — quote a field in the YAML if it must stay a string. This converter also expects a single YAML document: files that contain multiple sections separated by --- should be converted one document at a time.

Example: YAML in, JSON out

A before-and-after using sample YAML.

YAML input
service: api
replicas: 3
ports:
  - 80
  - 443
env:
  TIER: prod
JSON output
{
  "service": "api",
  "replicas": 3,
  "ports": [
    80,
    443
  ],
  "env": {
    "TIER": "prod"
  }
}

Frequently Asked Questions

Common questions about converting YAML to JSON.

Does this support multi-level YAML and lists?

Yes. Nested mappings, sequences (lists), and scalar values are parsed and converted into the equivalent nested JSON objects and arrays.

Are YAML anchors and aliases resolved?

Yes. Anchors (&) and aliases (*) are expanded during parsing, so the JSON output contains the fully resolved values rather than references.

Can it convert multiple YAML documents at once?

No. The converter expects a single YAML document. If your file separates sections with ---, convert each document one at a time.

Is my YAML sent anywhere?

No. Parsing and conversion run in your browser, so manifests that contain secrets or internal configuration never leave your machine.