CSV to JSON: Stop Emailing Spreadsheets to Developers

Published June 17, 2026 · 5 min read

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.

The Real Problem Isn't the Format — It's the Structure

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:

Why Browser-Based Conversion Beats Excel Export

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.

Nested Data: The Thing Excel Can't Do

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.

Three Mistakes I See Repeatedly

  1. Empty rows: Excel users love adding blank rows "for readability." JSON parsers don't. Strip them during conversion.
  2. Type guessing: Most converters try to guess whether "00123" is a number or a string. If it's a product code or ZIP code, it should stay a string. I've seen ZIP code 02134 become the number 2134 after a round-trip through a type-guessing converter.
  3. Numeric precision: JSON numbers are double-precision floating point. If your CSV has a column like "account_balance" with values like 9999999999999999, that number won't survive the conversion exactly. Store it as a string if you need precision.
Quick tip: Before converting a large CSV, convert the first 3 rows and validate the JSON structure. It's easier to fix a mapping issue on 3 rows than on 50,000.

What I Use Now

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."

Sam Taylor Written by Sam Taylor — Full-Stack Developer. I've spent years building web tools and learned that most "data import problems" are really data structure problems. More about me →