YAML to JSON Converter

Paste YAML and get the same data as JSON, ready to copy or download as data.json. A mistake in the YAML is shown with the line and column where it was found.

Free Runs in your browser Checked Tuesday, November 10, 2026

YAML 1.2 text. Several documents separated by --- are allowed. Up to 2,000,000 characters.

Result

Validity — Valid YAML, or the line and column of the first error.
JSON text

This tool runs in your browser. What you enter is not sent to us.

How to use it

  1. Paste your YAML into YAML text.
  2. Read Validity. If it names a line and column, fix the YAML at that place.
  3. If the YAML holds several documents, the JSON text is one array with an item for each document.
  4. Copy the JSON text, or download it as data.json.

How the YAML is read

YAML 1.2 is defined by its specification, which says how indentation, names, lists, quoted text and blocks are read. This tool reads the text with the yaml library, which follows that specification, and then writes the result as JSON.

  • A mapping becomes a JSON object, with its names in the order they are written. A sequence becomes an array. The words true, false and null become booleans and null, while quoted text stays text.
  • A whole number keeps every digit. A repeated name in one mapping is reported as an error, because JSON would keep only one of its values.
  • A value such as .inf or .nan has no JSON form, so it is refused rather than written as null or as a changed number.

Several documents and aliases

A YAML file can hold several documents, each started by a line with ---. The converter reads them all. One document gives one JSON value; several give a JSON array with one item per document, in the order they appear. An alias (*name) is replaced by the value it points to. A file that repeats an alias so often that the result would explode in size is refused.

Worked example: a file with two documents

Example 2.7 of the YAML 1.2 specification, Two Documents in a Stream, has a list of home-run hitters, then a line with ---, then a list of teams. Converted, the result is a JSON array of two arrays, one for each document.

The first array holds the three players and the second holds the two teams, in the order they are written.

Document JSON item
1 ["Mark McGwire", "Sammy Sosa", "Ken Griffey"]
2 ["Chicago Cubs", "St Louis Cardinals"]

Frequently asked questions

Why does the error show a line and a column?

The position is where the parser noticed the problem, counted from 1. The actual mistake can sit a little earlier, for example an indent that is wrong on the line before the one named.

What does the note about several documents mean?

Each line that starts with --- begins a new document. The JSON is then an array with one item for each document, in order. If you meant one document, remove the extra --- line.

Why does .inf or .nan give an error?

JSON has no infinity and no not-a-number, so such a value cannot be written without changing it. Replace it with a number or with text, and convert the YAML again.

Are numbers changed in the conversion?

Whole numbers keep every digit, so 12345678901234567890 is written exactly. A decimal number is written as the nearest JavaScript number, so 1.50 becomes 1.5 with the same value.

Does the JSON keep the order of the names?

Yes. Names appear in the order they are written in the YAML. A JavaScript object would move a name such as 2024 to the front, and this converter does not.

Is my YAML uploaded anywhere?

No. The conversion runs in your browser, and nothing you paste is sent to our server.

Sources

Figures and text last checked on Tuesday, November 10, 2026.

We use necessary cookies to run the site. With your consent, Google also uses advertising cookies to show personalised ads. If you reject them, you still see ads, but they are not personalised.