Skip to content

YAML to JSON Converter

Convert YAML to JSON or JSON to YAML, with anchors, multiple documents, sorted keys and clear errors, for config files, Kubernetes manifests and APIs.

  • Free, no sign-up
  • Runs in your browser
  • Sources cited

Paste YAML or JSON; the direction is detected unless you choose it.

JSON

Documents
1
Aliases expanded
1
Characters
319
JSON has no comments, so the YAML comments were left out.

Everything runs in your browser. Nothing you enter is uploaded.

How to use the YAML to JSON converter

  1. Paste or open a file

    Paste YAML or JSON, or open a .yaml, .yml or .json file. The direction is detected, or you can choose it.

  2. Choose the format

    Pick the indentation, sort keys alphabetically, and for YAML output choose how long lines fold and how strings are quoted.

  3. Fix errors

    If the input is not valid, the message names the line and column of the problem.

  4. Copy, download or reverse

    Copy or download the result, or send it back to the input to convert it the other way.

How YAML and JSON relate

JSON writes objects, arrays, strings, numbers, true, false and null with braces, brackets and quotes. YAML 1.2 describes the same data with indentation instead, and adds comments, multiple documents in one file separated by ---, and anchors (&name) that later aliases (*name) refer back to. Every JSON document is also valid YAML 1.2.

Converting YAML to JSON expands every alias into a full copy and applies merge keys (<<), which copy a mapping’s entries into another. Comments have no place in JSON and are left out. A file with several documents becomes a JSON array. To stop a small, hostile file from expanding into an enormous one, the converter refuses aliases that would expand beyond a fixed number of nodes.

YAML versions differ in one way that often surprises people: YAML 1.1 reads yes, no, on and off as true and false, while YAML 1.2 reads them as text. Choose 1.1 when the file comes from a tool that still uses it. The conversion uses the open-source yaml library in your browser.

Worked example

The example service definition sets 3 replicas and defines shared defaults with the anchor &defaults. The first route merges them with <<: *defaults, so in the JSON it gets "timeout": 30 and "retries": 2 as its own fields, while the second route does not.

The comment on the first line is left out of the JSON, which is 319 characters long with 2-space indentation. With YAML 1.1 the word yes becomes true; with YAML 1.2 it stays the string "yes".

Understanding the result, and common mistakes

  • Tabs for indentation. YAML allows only spaces for indentation; a tab causes an error.
  • Unquoted values that look like something else. 1.10 is a number, and in YAML 1.1 yes and no are booleans. Quote them to keep them as text.
  • Expecting comments to survive. JSON cannot hold them, and they do not come back when converting back to YAML.
  • Duplicate keys. YAML forbids them; the converter reports the line of the second one.

Frequently asked questions

Is my file uploaded?

No. Conversion runs in your browser, and links never include the text.

Can it convert Kubernetes manifests with several documents?

Yes. Each document separated by --- becomes one item of a JSON array.

Why did my numbers or booleans change?

YAML guesses types from plain values. Quote a value to keep it as a string, or switch the YAML version if yes and no should stay text.

Does converting back give the same YAML?

The data is the same, but comments, anchors and the original layout are not kept: aliases come back as full copies.

Sources

  1. YAML Ain’t Markup Language version 1.2.2YAML Language Development Team · retrieved Nov 14, 2026
  2. RFC 8259: The JavaScript Object Notation (JSON) Data Interchange FormatRFC Editor · retrieved Nov 14, 2026
  3. Merge Key Language-Independent Type for YAML 1.1YAML Language Development Team · retrieved Nov 14, 2026
  4. Boolean Language-Independent Type for YAML 1.1YAML Language Development Team · retrieved Nov 14, 2026
  5. yaml: JavaScript parser and stringifier for YAMLEemeli Aro · retrieved Nov 14, 2026

About these results

  • Conversion runs in your browser. Nothing you paste or open is uploaded.