· 5 min read
JSON, YAML or TOML? Converting configuration without surprises
What changes when config moves between JSON, YAML and TOML: the Norway problem, version strings, octal numbers, nulls, comments and large integers — and how to fix each.
42 tools
Every pairing you are likely to need between CSV, JSON, XML, YAML, TOML, NDJSON, Excel, SQL inserts and Markdown or HTML tables — with type inference that doesn't mangle IDs.
Data formats come in two shapes. CSV, TSV, Excel sheets and SQL inserts are tables: rows of the same columns. JSON, XML, YAML and TOML are trees: values nested inside values. Converting within a shape is lossless. Converting between shapes needs rules, and the rules are where data gets damaged.
Going from a tree to a table, nested objects are flattened into dotted column names and the header is built from every key in every record. Going from a table to a tree, each row becomes an object, and dotted headers can be expanded back into nesting.
CSV has no types, so converters guess — and the usual guess, “if it looks like a number, make it a number”, silently destroys ZIP codes (00501 → 501), phone numbers and any ID longer than 15 digits. The converters here only convert values that are unambiguously numeric, and leave everything else as text.
· 5 min read
What changes when config moves between JSON, YAML and TOML: the Norway problem, version strings, octal numbers, nulls, comments and large integers — and how to fix each.
· 4 min read
Prove a data migration worked: row counts, aggregates, row hashes and key-based diffs — and how to normalise data so you compare values, not formatting.
· 5 min read
Why CSV imports break — mojibake, BOMs, semicolon delimiters, Excel dropping leading zeros, line breaks inside values — and how to fix each before you upload.