HTML to YAML for data files
Static site generators, documentation tools and many test setups read structured data from YAML files: a team page, a list of events, a glossary, a set of fixtures. When that data already exists as a table in an old page or a CMS export, this html to yaml converter turns it into a YAML sequence of mappings, one entry per row, with the column headings as keys.
The output is plain YAML that any parser can read, with one entry per row that you can drop into a data folder and loop over in a template.
Example: a team table
<table>
<tr><th>Name</th><th>Role</th><th>Profile</th></tr>
<tr><td>Priya Shah</td><td>Editor</td>
<td><a href="https://example.com/priya">priya.dev</a></td></tr>
<tr><td>Tom Reyes</td><td>No</td><td></td></tr>
</table>
converts to:
- Name: Priya Shah
Role: Editor
Profile: priya.dev
- Name: Tom Reyes
Role: 'No'
Profile: ''
Two details are worth noticing. The link was reduced to its visible text; the URL in href is not kept, so add it back by hand if your template needs it. And the value No was written in quotes. Some YAML parsers, following the older YAML 1.1 rules, read an unquoted No, Yes, On or Off as a boolean, so the converter quotes such strings to make sure they stay text. Empty cells become ''.
Options
- First row is header – headings become keys; blank ones become
column1-style names by position and repeated ones get_2. Unticked, each row is written as a YAML list of values. - Detect numbers & booleans – writes
24.99andtrueunquoted as numbers and booleans. When off, every value is a string, and strings that look like numbers are quoted, for examplePrice: '24.99'. - Indent – 2 or 4 spaces for nested entries.
- Sort keys – orders the keys of each entry alphabetically instead of following the column order.
Multiple tables and keys with spaces
If the page contains several top-level tables, the YAML becomes a mapping with one list per table, keyed by the table's id or by table1, table2 and so on. Keys that contain spaces, such as In stock, are valid YAML and stay as written, but templates often access them more easily when you rename the heading to in_stock before converting.
Check the file with the YAML validator before committing it, or convert the same table with HTML to JSON if your tooling expects JSON data files. For converting YAML onward, YAML to JSON is available as well.
Privacy
The table is parsed and converted in your browser. Only Load URL (fetched through our server) and Save & Share (stored for the link) involve our server.