Convert YAML to CSV

Turn YAML files into CSV. A list of objects becomes one row per object under a header of every key in first-seen order, and a single object becomes one row.

Converted in an isolated sandbox on our serversDeleted after 24 hours

Drop YAML files on the dialor turn it to pick what to do

A table from your YAML list.Each object in a list becomes one row, under a header of its keys.

  1. What you get

    A CSV file with one row per object. The header holds every key, in the order each key first appears. A single object becomes one row.

    If the file has several YAML documents, they are treated as one list, so each document becomes a row.

  2. How values are written

    A nested object or list is written into its cell as JSON text. A null value leaves the cell empty.

    Aliases are expanded, so each row holds the values the alias points to. Comments are dropped, since CSV has no place for them.

  3. Values stay text

    Values such as yes, on, 0755 and dates stay text. They are not turned into true, 1 or 493, so they appear in the CSV as you wrote them.

    A merge key (<<) is not merged. It is kept as an ordinary key, so it gets its own column in the header.

  4. When it stops

    If the file cannot be parsed, the conversion stops with input_corrupted. The YAML needs to be valid before it converts.

    To go the other way, use CSV to YAML.

YAML and CSV.What each format is.

The formats

From · YAML

YAML

YAML configuration and data files.

Extensions
.yaml .yml
MIME type
application/yaml
Kind
Text and data
To · CSV

CSV

Rows of comma-separated values. The plainest way to move a table between programs.

Extensions
.csv
MIME type
text/csv
Kind
Text and data

In your code.The same YAML to CSV conversion through the API, for your app or your agent.

terminal
$ cv convert report.yaml report.csv
$ cv convert report.yaml report.csv

Questions.What people ask about YAML to CSV.

01OF 04

Each object in a list becomes one row. The header lists every key in the order it first appears, and a single object becomes one row.

Nested objects and lists are written into their cell as JSON text. The cell holds the whole nested value.

Comments are dropped. Aliases are expanded, so the values they point to are written out in each place they are used.

The file could not be parsed as YAML. The conversion stops with input_corrupted in that case.

More conversions.Other ways in and out of YAML and CSV.