Data wrangling is mostly converting between YAML, JSON and CSV. Here's when each format wins and the traps when converting.
Pick the right format
- JSON: APIs and machine-to-machine data. Strict, no comments.
- YAML: human-edited config (Kubernetes, CI). Comments allowed, but whitespace-sensitive.
- CSV: flat tabular data and spreadsheets. No nesting, no types.
Traps
-
The Norway problem: in YAML 1.1, unquoted
NOparses as boolean false. Quote country codes. -
Type loss in CSV: everything is a string; leading zeros (
007) vanish if a spreadsheet re-saves them as numbers. -
Nested JSON to CSV: you must flatten or choose a column strategy (
user.address.city). -
Commas and newlines in CSV fields need quoting; naive
split(',')breaks. - Comments are lost going YAML to JSON. Keep the YAML as source of truth.
Convert without uploading data
These run entirely in the browser, so configs with secrets never leave your machine:
- YAML to JSON
- CSV to JSON
- CSV to SQL
- YAML Formatter
- CSV Diff to compare two exports
Disclosure: I'm the author of Web Developer Toolbox. What conversion do you do most?
Top comments (0)