My Tool Studio
Developer Tools·4 min read

How to Convert JSON to Excel Without Losing Types

Sooner or later someone asks for the data in Excel. The JSON came from an API, it has nested objects and arrays, and the person asking does not want a text file. Converting through CSV works, but Excel then guesses every column's type, and those guesses turn IDs into numbers and long numbers into scientific notation. Writing a real workbook avoids that. This guide shows how JSON maps to rows, columns and sheets, walks through an example, and covers the settings that matter.

.json.excelJSON → EXCEL

Why not just save CSV?

Where the guessing goes wrong.

CSV has no types. Every cell is text, and Excel decides what each one means when it opens the file. It reads 00123 as the number 123, 1234567890123456 as 1.23457E+15, and 3-4 as a date in March or April. Once the file is saved again, the original values are gone.

An .xlsx file stores a type for every cell. Numbers are numbers, text is text and true or false are booleans, exactly as they were in the JSON. The JSON to Excel converter writes that format directly, in your browser, so the spreadsheet matches the data instead of Excel's guess about it.

How JSON becomes rows, columns and sheets

A few fixed rules.

Each object in an array becomes one row, and each key becomes a column the first time it appears. Keys that only some objects have still get a column, and the other rows leave that cell empty. Numbers become numeric cells, true and false become boolean cells, and null becomes an empty cell.

Nested objects are flattened into dotted column names, so a customer object with a name inside produces a customer.name column. When the top level of your JSON is an object holding several lists, for example orders and customers, each list becomes its own sheet named after its key. If your records sit deeper, type the path to them, such as data.items, in Array path and they become a single sheet.

A worked example

Orders and customers, two sheets.

Press Try sample on the JSON to Excel page. The sample has an orders list, where each order has an id, a date, a nested customer with a name and a country, a total, a paid flag and an items array, and a customers list with a name, an email and the year they joined.

The preview shows two sheets. The orders sheet has the columns id, date, customer.name, customer.country, total, paid and items. Totals such as 42.5 are numbers you can sum, paid shows TRUE or FALSE, and the items array reads lamp; bulb in a single cell. The customers sheet is a plain three-column table. Press Download and Excel opens a workbook with filter buttons on each header row and columns already sized to their contents.

If the preview does not look right, change a setting and it redraws at once. The Preview sheet menu switches between sheets and shows each one's row count, so you can confirm that every order made it across before you download. Nothing is written to disk until you press the button, and you can download again in another format without starting over.

Settings that change the result

Most JSON converts well with the defaults. These options cover the cases where it doesn't.

  • Arrays: Join values with ; puts a list of simple values in one readable cell. Keep as JSON text writes the array exactly, which suits arrays of objects. One column per item spreads the values over columns such as items.0 and items.1.
  • Flatten nested objects: untick it to keep each nested object as JSON text in one cell, which gives fewer, wider columns.
  • One sheet per top-level list: untick it when you only want the first list, or use Array path to pick one.
  • Format: .xlsx for current Excel, .xls for very old versions, and .ods for LibreOffice.
  • Header row, filter buttons and fitted widths can each be switched off if another program reads the file.

Common problems and how to avoid them

Text that looks like a number stays text if it was a string in the JSON. That is usually what you want for IDs and postcodes, but a price sent as "19.99" will not sum. Fix the source if you can, or convert the column in Excel with Data, Text to Columns.

Excel caps a sheet at 1,048,576 rows and a cell at 32,767 characters. The converter cuts longer text to fit and tells you how many cells were affected. Very deep or irregular JSON produces a lot of sparse columns; in that case, pick the one list you need with Array path, or look at the data in the JSON Viewer's table first to see which fields matter.

Keeping the data private

The workbook is built by JavaScript in your browser and saved straight to your device, so exports with customer names, emails or order totals are never uploaded. Only Load URL uses the site's server, to fetch a public address. For a plain text export with a custom delimiter, the JSON to CSV Converter uses the same flattening rules, and CSV to JSON goes the other way, including straight from an uploaded .xlsx file.

Try it now

Open JSON to Excel Converter

The tool is one click away. No sign up, no upload, no payment.

Open JSON to Excel Converter