A marketing manager once emailed me a 47-column Excel sheet with merged cells and asked me to "just import it into the database." I stared at that spreadsheet for twenty minutes before responding. Not because I couldn't parse it — but because I had to explain why row 3 being a sub-header for rows 4-18 wasn't something any script would magically understand.
I've been on the receiving end of badly-structured data for years. The fix is almost always the same: convert CSV to JSON, but do it with a structure that actually maps to how databases and APIs work. Here's what I've learned about doing it right — and why it matters more than most people think.
CSV is a flat table. JSON is nested. The conversion seems straightforward until you hit a column that contains multiple values, or a row that's actually a grouping header, or — my personal favorite — a "Notes" column where someone typed paragraphs of free text with commas in it.
I recommend opening any CSV you plan to convert and checking three things first:
Excel has a "Save as CSV" button. But then you need a second tool to go from CSV to JSON. Every extra step is a chance for encoding to break, for a column to get truncated, or for someone to open the file, make a "quick edit," and re-save it with different settings.
I prefer browser-based converters for this workflow because the data never leaves your machine. Upload the CSV, map the fields if needed, download JSON. No server, no email attachment, no "version 4 final FINAL.xlsx."
According to ECMA-404, the JSON standard explicitly supports Unicode, which means UTF-8 characters survive the trip. CSV has no such guarantee — it predates Unicode by decades.
Here's where CSV to JSON gets interesting. Let's say you have an online store. Each order has one customer, but multiple line items. In CSV, you either flatten everything (one row per line item, customer info repeated) or split into multiple files. In JSON, it's natural:
{
"orderId": "ORD-1042",
"customer": {"name": "Jane Reyes", "email": "[email protected]"},
"items": [
{"sku": "BT-990", "qty": 2, "price": 14.99},
{"sku": "CC-445", "qty": 1, "price": 29.00}
]
}
I learned this the hard way building an inventory dashboard for a small retailer. They sent me a 12-sheet workbook. By sheet four I realized the data had a natural parent-child structure that CSV was fighting against. Converting to nested JSON cut the import script from 200 lines to about 40.
After trying a dozen approaches over the years, I built the converter into Formly — drag a CSV in, get JSON out, everything stays in the browser. It handles auto-detection of delimiters and encoding, and importantly, it doesn't guess your data types. I use it myself whenever a client sends me a spreadsheet that's "ready for the database."