YAML to JSON Converter

Paste YAML to get JSON, or switch the direction to turn JSON into YAML. XML works both ways too. Errors show the line and column, and your data stays in your browser.

From
To
Style
Indent

✓ Valid YAML, converted to JSON.

Converted in your browser; your data isn't uploaded. Nothing in the file is run, and external entities and links aren't fetched.

How to use it

  1. Paste YAML or open a .yaml or .yml file (a .json file switches the direction for you).
  2. Pick what to convert to, the indent, and whether to sort keys A–Z. ⇄ swaps input and output.
  3. Copy the result or download it.

How YAML maps to JSON

  • Maps become objects and lists become arrays; plain numbers, true, false and null (or ~) become JSON values; everything else is text.
  • Dates such as 2026-10-11 stay text, because JSON has no date type.
  • Block text written with | keeps its line breaks as \n; text written with > is folded into one line.

Example

The app settings loaded above have a comment, a list of owners and an inline list, [search, pdf, ocr]. In JSON the comment is gone, port: 8080 and debug: false become the number 8080 and the boolean false, version: 2.4.0 stays the text "2.4.0" (it isn't a valid number), and released: 2026-10-11 becomes the text "2026-10-11". Convert that JSON back to YAML and the date comes out quoted, '2026-10-11', so no reader can mistake it for a date.

Conversion uses the open-source js-yaml (MIT licence). For XML, see the XML to JSON converter; to tidy JSON on its own, use the JSON formatter.

Frequently asked questions

Why does "no" stay as text instead of becoming false?

This converter follows YAML 1.2, the current version, where only true and false are booleans. Older YAML 1.1 readers also turn yes, no, on and off into booleans, so a country code NO for Norway could become false. To be safe in every reader, quote values like "no" and "on" in your YAML; JSON to YAML does that for you.

Where did my YAML comments go?

JSON has no comments, so they can't be carried over. Anchors (&name) and aliases (*name) are also expanded into full copies, and << merge keys are merged in, because JSON has no way to point at another part of the file.

What happens to a file with several documents?

A YAML file with several documents separated by --- becomes one JSON array, with one item per document, and a note says so. Kubernetes manifests are often written this way.

Why is my YAML invalid when it looks fine?

The usual causes are a tab used for indenting (YAML allows only spaces), items of one list indented by different amounts, a key repeated in the same map, or a colon followed by a space inside an unquoted value. The error shows the line and column.

Do numbers keep all their digits?

Numbers up to 9,007,199,254,740,991 do. Longer ones, such as 20-digit IDs, lose their last digits when read as numbers in any JavaScript tool, so quote them in the YAML to keep them as text. A leading zero is dropped: 0755 becomes 755, so quote file modes and codes too.

More text and developer tools

See all text and developer tools →

Can't find the tool you need? Tell us, and the most requested tools get built first.