JSON ↔ YAML Converter

Convert JSON to YAML and YAML to JSON. Choose indent, sort keys, switch flow style — all in your browser.

0 chars
0 chars

Bidirectional

Convert JSON to YAML or YAML to JSON in one click. Reuse the output as the next input to round-trip and verify losslessness.

Config-ready

Output is ready to paste into Kubernetes manifests, GitHub Actions, Docker Compose, Ansible, or any YAML-based config.

Private

Parsing and conversion run in your browser via js-yaml. Your secrets and config never leave your device.

JSON and YAML describe the same data

Both formats model the same fundamental shapes: maps (objects), sequences (arrays), and scalars (strings, numbers, booleans, null). JSON optimizes for machines — it is strict, brace-heavy, and easy to parse. YAML optimizes for humans — indentation replaces braces, quotes are usually optional, and comments are first-class. Converting between them is mostly a re-rendering of the same tree.

When YAML is more than JSON

YAML supports a few features JSON cannot represent: anchors and aliases (&ref, *ref), explicit tags (!!str), non-string mapping keys, and multi-document streams (---). When you convert YAML to JSON, anchors are expanded into duplicated data, tags are dropped, and only the first document is kept. For straight config files this is exactly what you want.

Common conversion targets

Kubernetes manifests, Helm values.yaml, GitHub Actions workflows, GitLab CI pipelines, Docker Compose files, Ansible playbooks, OpenAPI specs, and Prometheus rules are all YAML. APIs, webhooks, log lines, and database columns are almost always JSON. Convert in whichever direction your next tool expects.

Frequently asked questions

What does a JSON ↔ YAML converter do?

It converts data between JSON (the default for APIs and web payloads) and YAML (the default for configuration files like Kubernetes manifests, GitHub Actions workflows, Docker Compose, and Ansible playbooks). Both formats describe the same shape of data — objects, arrays, strings, numbers, booleans, and null — so the conversion is lossless in both directions for any JSON-compatible document.

Why convert JSON to YAML?

YAML is dramatically easier to read and write by hand. Indentation replaces braces and brackets, quotes around keys are usually optional, and you can add comments. Most DevOps tooling — Kubernetes, Helm, GitHub Actions, GitLab CI, Ansible, Docker Compose — expects YAML, so converting JSON output from an API into YAML is a common chore.

Why convert YAML to JSON?

JSON is the universal data interchange format. Programs, APIs, and databases consume JSON natively; very few accept YAML directly. Converting a config file to JSON lets you pipe it into jq, post it to a webhook, embed it in an HTTP request body, or feed it into a tool that only understands JSON.

Is the conversion lossless?

For any JSON document, yes. JSON's value types (object, array, string, number, boolean, null) all map cleanly to YAML. Going the other direction is lossless only for the JSON-compatible subset of YAML — advanced YAML features like anchors, aliases, custom tags, and non-string keys do not exist in JSON and are flattened or rejected.

What indentation does the YAML output use?

You choose 2 or 4 spaces. Two-space indentation is the de-facto standard in the Kubernetes and Ansible ecosystems and is what tools like kubectl and helm emit by default. Four-space indentation can be more readable for deeply nested documents.

What is 'flow style'?

YAML has two notations: block style (indentation-based, the default) and flow style (inline, looks like JSON with braces and brackets). Flow style is compact and useful when embedding small structures inside a larger document. Most config files use block style because it is easier to diff and review.

How are types preserved?

The converter uses the JSON schema for YAML parsing, which means numbers, booleans, and null are recognized exactly the same way JSON parses them. Strings that look like numbers stay strings only if they were quoted in the YAML source — unquoted '01' becomes the number 1, just as the YAML 1.2 spec requires.

Does the converter handle multi-document YAML?

It parses a single YAML document. If you need to convert a multi-document file (separated by '---'), split it into individual documents first or paste each one separately. JSON has no native multi-document concept, so a multi-document YAML file would need to be wrapped in an array for the round-trip.

Is my data sent to a server?

No. Parsing, conversion, and download generation all happen in your browser using js-yaml. Your data never leaves your device, which makes the tool safe for sensitive configuration files containing API keys, internal hostnames, or other secrets.

Part of our growing tool belt — all client-side, all free.