Using the YAML to JSON Converter
This converter reads a restricted subset of YAML and writes JSON. Nested mappings, lists, numbers, strings, booleans, null, and literal block text are accepted. Tags, anchors, aliases, and flow collections are rejected.
One YAML document becomes one JSON value. Several documents, separated by a line that is only three hyphens, become a JSON array, and the result says how many documents were read. The extra documents are not dropped.
The YAML 1.2.2 specification is published at https://yaml.org/spec/1.2.2/. This page implements a safe subset of that syntax. It does not construct PHP objects and it does not execute code.
Values that convert
name: Ada becomes a JSON string. count: 2 becomes a JSON number. active: true becomes true. note: null, or a tilde, becomes null.
A dash list becomes a JSON array in the same order. A nested key becomes a nested object. A pipe block keeps its line breaks inside one JSON string.
Pretty output is indented. Minified output is the same value without that extra space. Download converted.json for either form.
Text and file input
Paste YAML in the text area or choose a .yml or .yaml file. A file replaces the pasted text when both are present. An empty file is rejected.
The input limit is 100000 characters. Tabs are rejected so indentation stays visible. Use spaces.
Reset the form before you convert a second document if you do not want the previous text included.
What is rejected
An ampersand anchor, an asterisk alias, and an exclamation-mark tag are rejected. Those features can expand a small document or name a type. This page does not need them to produce JSON.
Flow sequences and flow mappings, the forms written with brackets or braces on one line, are rejected. Write a block list or a block mapping instead.
A mapping cannot repeat a key. Nesting deeper than 32 levels is rejected. More than 20 documents is rejected.
Checking the JSON
Compare the download with the text on the page before you send it on. Pretty and minified forms should contain the same values.
Open the downloaded file in the JSON Prettifier when you want another view of the same text. The values should match.
A mapping that is not a list of rows will not become a tidy table later. Look at the shape before you treat it as a spreadsheet.
When the JSON is a table
Some YAML files are a list of records. Those can become rows after the JSON exists.
A JSON array or object can continue into the JSON to CSV Converter when the shape is a table. Not every YAML mapping is a table.
If the CSV is missing columns, the YAML was not a uniform list of records. Fix the YAML rather than editing the CSV by hand and calling it the same conversion.
Minified output
Choose minified JSON when you need the shorter text. The conversion is the same.
Minified JSON can go through the JSON Minifier only as a second check. This page already writes minified JSON when that option is selected.
Copy the result if you only need the text. The download is there when you need a file named converted.json.
Nearby conversions
XML is a different syntax with its own rules for attributes and nested elements.
The XML to JSON Converter is the tool for an XML document. Pasting XML here will fail as YAML, which is the right failure.
Syntax errors name the line that could not be read when the line is a mapping the parser does not recognize. Fix that line and run the conversion again.
CSV is not YAML
A spreadsheet export is often CSV. Commas in that file are not YAML indentation.
The CSV to JSON Converter reads that shape. Do not paste CSV into this YAML parser and expect a table.
If a file is YAML that happens to contain commas inside strings, leave those commas inside the quotes or the plain string and let this parser read the indentation.