What Excel may change, and how to stop it
Turning JSON into CSV is the easy part. The hard part is opening that CSV in a spreadsheet and still having the data you started with. When Excel opens a CSV, its default is to turn anything that looks like a number into a number, and IDs and zip codes don't survive that. If a customer has ever asked where their zip codes went, this is why.
| In your JSON | In this CSV | After Excel converts it |
|---|---|---|
| 90071992547409931 | 90071992547409931 | 90071992547409900 |
| "07030" | 07030 | 7030 |
Save that file, and the real ID is gone. So the report in the tool counts the values at risk before anyone opens the file:
- Numbers with more than 15 digits
- Excel keeps 15 digits and turns the rest into zeros. The report counts these whether your JSON stores them as numbers or as text in quotes.
- Values that start with 0
- Zip codes, account numbers and extensions lose the 0 when Excel makes them numbers.
- Values that start with =, +, - or @
- Excel can read these as formulas, phone numbers like +1 201 555 0100 included. Worse, a cell from someone else's system can hold a real formula, and Excel will treat it as one. OWASP, the web security group, warns that formulas like that can be used to copy data out of the spreadsheet. If people will open the file in Excel, check "Stop formulas". A tab in front of each of those values is the fix OWASP recommends for Excel.
- Accents, curly quotes and other special characters
- Excel can show these wrong when a UTF-8 CSV has no marker at the start. Check "Add a UTF-8 marker", and Excel opens the file normally.
For long numbers and leading zeros, the fix is in Excel, not in the CSV. Excel for Microsoft 365 and Excel 2024 show a notice before they convert, listing what's about to change, and it lets you open the file once without converting. Converting is still the default, though. To stop it for good:
- Go to File > Options > Data. On a Mac, it's Excel > Preferences > Edit.
- Under Automatic Data Conversion, turn off "Remove leading zeros and convert to a number" and "Keep first 15 digits of long numbers and display in scientific notation".
Excel then keeps those values as text in every workbook, including what you type or paste, so a green triangle saying "Number stored as text" is expected. Microsoft lists that setting only for those two versions, so in Excel 2016, 2019 or 2021 on Windows, import the columns as text instead of double-clicking the file, as Microsoft describes:
- In Excel, go to Data, choose From Text/CSV next to the Get Data button, and pick the file. If you don't see Get Data, use New Query > From File > From Text.
- In the preview, select Transform Data (Edit in older versions) to open Power Query.
- Click the column header, then Home > Transform > Data Type > Text. Hold Ctrl to pick more than one column.
- When Excel asks, choose Replace current.
- Select Close & Load.
How the converter works
- Long numbers stay exact. Browser tools that read JSON the usual way (with JSON.parse) can round whole numbers past 9,007,199,254,740,991. That's fine for prices and bad for IDs, so this page reads each number exactly as it's written. A 20-digit ID comes out the way it went in.
- Each record is a row. If your JSON is one object with a single list of records inside, like
{"data": [...]}, the converter uses that list and the report says so. JSON Lines, one record per line, works too. Nested fields become columns named with dots, like address.city, in the order they first appear. - Lists inside a record have three options. Join the items into one cell with "; ", give each item its own column (tags.0, tags.1), or keep the list as JSON text. Joining is the one people can read; separate columns are the one other systems import best. When joining, a list of objects (say, several addresses) stays as JSON text in one cell.
- Commas inside a value don't shift your columns. A value with a comma, a double quote or a line break goes in double quotes, the way RFC 4180 describes, so every spreadsheet reads it as one cell.
- Big files work. Files can be up to 50 MB. The preview shows the first 100 rows, and copy and download include all of them. If the result won't fit in one Excel sheet (1,048,576 rows by 16,384 columns), the report says so.
Questions
- Can Excel open a JSON file directly?
- Yes. In Excel, Data > Get Data > From File > From JSON opens the file in Power Query, where you expand the nested fields yourself. That works for one file you'll analyze in Excel. For a CSV you can send to someone or load into another system, convert it here.
- JSON or CSV: which is better?
- Neither. JSON keeps structure: nesting, lists, and the difference between a number and text. CSV is flat text that every spreadsheet and import screen reads. Keep the JSON as your source and make CSVs from it when a person or a tool needs a table.
When the data isn't in a JSON file yet
If you're converting JSON because a new customer sent an export from the system they're leaving, this file is the easy case. Across Rubie's migrations, 95% of source systems don't have a clean API or export that captures all the data needed. Whatever the export misses sits behind a login, in a legacy app, or in a 250-page PDF.
That's the job Rubie does. It moves a new customer's history out of the system they're leaving and into your product, without engineering time, so onboarding doesn't stall on the data. See how Migration Playbooks run a migration end to end.