JSON to Excel and CSV: a plain-language guide for non-programmers
Last reviewed
Apps and websites often export data as JSON, a text format that is easy for programs to read but awkward for people. If you have been sent a .json file and need to sort, filter or total it, the answer is usually to turn it into a spreadsheet. This guide explains how that works and the few things that commonly go wrong.
What a JSON file looks like
JSON stores data as names and values, such as "name": "Asha" and "amount": 450, grouped in curly brackets. A list of records is wrapped in square brackets. A list of records with the same names, such as orders each with an id, a date and an amount, maps neatly to a spreadsheet: each record becomes a row, and each name becomes a column heading.
Excel or CSV?
- JSON to Excel gives you an .xlsx workbook with a bold header row, ready to open in Excel. Choose this if you will work in Excel.
- JSON to CSV gives you a CSV file, plain text with commas between values. Choose this to import data into another system, Google Sheets or a mail merge.
- Both run in your browser, are free and need no account.
Nested data becomes dotted column names
A record can contain another group, for example an address with a city and a PIN code. A spreadsheet has no place for a group inside a cell, so the group is flattened into columns named address.city and address.pin. You can rename or delete those columns afterwards.
Three things that commonly go wrong
- Lost leading zeros. Spreadsheets treat 007 or a PIN code starting with 0 as a number and drop the zero when they open a CSV. Format such columns as text, or check them after opening.
- Broken Indian-language text. If names in Hindi or other scripts look garbled when you open a CSV in Excel, import it with Data, From Text/CSV and choose UTF-8, instead of double-clicking the file.
- The file will not convert. JSON must be exactly valid: a missing comma or quote stops it. JSON Formatter shows the line and column of the first mistake.
Going the other way
If you keep a list in a spreadsheet and an app needs it as JSON, save it as CSV (UTF-8) and use CSV to JSON. Put the column names in the first row. Values that look like numbers become numbers, so check codes with leading zeros in the result.