Convert CSV to YAML
This tool turns a CSV file with a header row into a YAML list of mappings — one mapping per row, keyed by the column names. It is handy for generating config files, Ansible vars, CI matrices, or seed data from a spreadsheet export.
How it works
The CSV is parsed with an RFC 4180 scanner so quoted fields with embedded commas,
doubled quotes (""), and line breaks are handled correctly. The first row supplies
the keys; each later row becomes a mapping in a top-level sequence.
Each value is serialised safely. A scalar is emitted plain (unquoted) only when it
is safe to do so; otherwise it is double-quoted with internal quotes and
backslashes escaped. This protects values that contain : (colon-space), a leading
#, leading or trailing whitespace, or that would otherwise be parsed as a boolean or
number. With “infer numbers and booleans” on, clean numeric literals and the words
true, false, and null are emitted unquoted as their YAML types.
Tips
Use block style for human-readable config you will edit by hand, and flow style
when you want compact one-line-per-record output. If a column holds identifiers such as
007 or phone numbers, turn off number inference so leading zeros and + prefixes
are preserved as strings.