JSON to YAML

Paste JSON and get clean, readable YAML with 2 or 4 space indentation. Text that a YAML reader could take for a number or a boolean is quoted, so the data stays exactly the same.

Free and private. Everything runs in your browser, nothing is uploaded.

How it works

  1. Paste or open a filePaste your data into the input box or open a file. Sample shows an example.
  2. Check the resultThe converted data appears on the right as you type. Errors show the line and column.
  3. Copy, download or swapCopy the result, save it as a file, or press Swap to convert it back.

YAML that reads back the same

Writing YAML by hand goes wrong in surprising places. The country code NO becomes false in older YAML readers, a version like 1.10 becomes the number 1.1, and a postal code like 0123 can lose its leading zero. This converter quotes every value that YAML 1.1 or YAML 1.2 would read as something other than text, and leaves all other text unquoted so the result stays easy to read.

Multi line text is written as a block with |, keys keep their original order, and empty objects and lists are written as {} and []. Use it to turn an API response into a configuration file, or to write Kubernetes and Docker Compose files from data you already have in JSON.

About JSON

JSON (JavaScript Object Notation) writes data as objects in curly braces, lists in square brackets, text in double quotes, numbers, true, false and null. Almost every API and programming language reads it.

About YAML

YAML is a text format for data that people read and write, based on indentation instead of brackets. It is used for configuration files and supports comments, multi line text and references to repeated parts.

Frequently asked questions

Why are some values in quotes?

They would change meaning without quotes. For example yes, on and off would become true or false in YAML 1.1, and 0123 or 1e3 could become numbers.

Is my data uploaded?

No. The conversion runs in your browser. Configuration files with passwords or keys never leave your device.

Why is yes still text in my JSON?

In YAML 1.2, the current version, only true and false are booleans. Older YAML 1.1 tools also read yes, no, on and off as booleans. Turn on the YAML 1.1 option if your file was written for such a tool.

What happens with several YAML documents?

If the input has more than one document, each starting with a line of three hyphens, the JSON result is a list with one item per document.

How are XML attributes shown in JSON?

Attributes get an @ in front of their name, for example @id. If an element has attributes and text, the text goes into #text. You can choose another prefix for attributes.

Does it work offline?

Yes. After you open the page once, it keeps working without an internet connection.