Tools

YAML → JSON

Convert YAML data to JSON format.

YAML
Ln:1 Col:1
JSON

About YAML to JSON Conversion

Converting YAML to JSON is essential when working at the boundary between configuration and code: parsing Kubernetes manifests programmatically, ingesting GitHub Actions workflows into automation scripts, processing Ansible inventory files with APIs, or migrating configuration formats. JSON is the universal intermediate format that every programming language and tool understands natively.

YAML Syntax Quick Reference

YAML documents use indentation (2 spaces by convention) to express hierarchy. Key-value pairs are written as key: value. Lists use the - item notation. Inline syntax also works: {key: value} for objects and [item1, item2] for lists. The optional --- document separator marks the start of a document.

Type coercion is one of YAML's most important (and sometimes surprising) behaviors. Unquoted values are automatically typed: true/false/yes/no/on/off become booleans; integers and floats are parsed as numbers; null/~ become null. Strings that look like numbers or booleans must be quoted to preserve their string type. YAML also supports multi-document files (separated by ---) and anchors/aliases (&anchor, *alias) for value reuse across the document.

FAQ

Are YAML anchors (&) and aliases (*) preserved in JSON?
Anchors/aliases are resolved to their actual values during conversion. JSON has no reference mechanism, so the same value is duplicated at each location.
Are YAML comments (#) included in JSON?
No. JSON does not support comments, so all YAML comments are removed during conversion. If you need to preserve comments, consider JSONC (JSON with Comments) format.
How are YAML multiline strings (| or >) converted?
Literal block (|) preserves newlines; folded block (>) converts newlines to spaces. In JSON, these appear as \n escape sequences.