YAML to JSON Converter

Convert YAML to JSON format instantly. Works with Kubernetes, Docker, Ansible, and any YAML document.

Quick answer

A YAML-to-JSON converter parses YAML's indentation-based structure into a data tree and serializes it as JSON: mappings become objects, sequences become arrays, and scalars keep their types. This tool uses the js-yaml 4 parser (YAML 1.2 core schema) and outputs 2-space-indented JSON entirely in your browser — nothing is uploaded. Paste YAML, click Convert to JSON, then copy or download.

How This Tool Converts YAML to JSON

When to Use YAML to JSON

Worked example

A small config that shows how each YAML type maps to JSON — and one value that's easy to get wrong:

Input YAML

name: John Smith
port: 8080
enabled: true
country: NO
roles:
  - admin
  - editor

Output JSON

{
  "name": "John Smith",
  "port": 8080,
  "enabled": true,
  "country": "NO",
  "roles": [
    "admin",
    "editor"
  ]
}

What happened

Edge cases & gotchas

Frequently Asked Questions

Can I convert Kubernetes YAML to JSON?

Yes. Paste any Kubernetes manifest, Helm values file, or Docker Compose YAML and the tool converts it to JSON, preserving all nested objects, arrays, and data types.

Does YAML to JSON preserve data types?

Yes. YAML strings → JSON strings, integers and floats → JSON numbers, true/false → JSON booleans, null → JSON null. The conversion is type-safe.

Is my YAML data sent to a server?

No. All conversion happens entirely in your browser. Your data never leaves your device.

What happens to YAML anchors and aliases?

Anchors (&name) and aliases (*name) are resolved during parsing. The output JSON contains the fully expanded values — the anchor references themselves are not preserved. If a value is referenced via three aliases, it will appear as three copies in the JSON output.

Does this tool handle multi-document YAML?

This tool converts a single YAML document at a time. Multi-document YAML files that use --- as a separator should be split into individual documents before converting each one separately.

Does this tool turn yes/no/on/off into booleans?

No. This converter uses the js-yaml 4 parser, which follows the YAML 1.2 core schema — only true and false are booleans, so yes, no, on, and off stay strings. Be aware that many other tools still use YAML 1.1, where those words do become booleans (the famous "Norway problem", where the country code NO becomes false). If your downstream system uses a YAML 1.1 parser, quote those values to keep them as strings.

What happens to YAML comments?

They are dropped. YAML comments start with # and carry no data, and JSON has no comment syntax, so there is nowhere for them to go. Only the actual keys, values, and structure survive the conversion.