Smart Unit ConvertersSmart Unit Converters

JSON ↔ YAML Converter

Convert between JSON and YAML in either direction. Live preview, parse-error reporting, copy + download.

JSONYAML

?What is the JSON ↔ YAML Converter?

The JSON ↔ YAML converter translates configuration data between the two most common structured-data formats. JSON (JavaScript Object Notation) is the default for web APIs and config files in most modern stacks; YAML (YAML Ain't Markup Language) is the standard for Kubernetes, Docker Compose, GitHub Actions, Ansible, and many DevOps tools. The conversion is structurally lossless: nested objects, arrays, booleans, nulls, numbers, and strings round-trip cleanly. Powered by js-yaml, which implements the YAML 1.2 specification.

The Formula

Round-trip: JSON.parse(json) → js-yaml.dump → YAML; js-yaml.load(yaml) → JSON.stringify → JSON. Numbers, booleans, null, arrays, and objects are preserved structurally.

Practical Examples

1

Convert a Kubernetes manifest from YAML to JSON for use with `kubectl --output=json`.

2

Convert a `package.json` snippet to YAML for an Ansible playbook.

3

Convert a Docker Compose `docker-compose.yml` to JSON for programmatic editing.

4

Convert GitHub Actions YAML workflows to JSON when integrating with custom automation.

5

Convert a Postman/Insomnia API response from JSON to YAML for documentation.

Frequently Asked Questions

YAML 1.2 is officially a superset — every valid JSON is valid YAML. So converting JSON to YAML almost always works; the reverse depends on the YAML using only JSON-compatible features (no anchors/aliases, no custom tags).

Popular Conversions

Jump to a ready-made conversion — useful for quick reference and sharing: