About Excel to JSON
This Excel to JSON converter uses the SheetJS library to parse xlsx, xls, and csv files locally in your browser, transforming them into structured JSON objects or arrays. Parsing supports multiple worksheet selection, header row positioning, nested header recognition, and custom key mapping. Unlike converting to plain text or CSV, JSON is about preserving and expressing structure. SheetJS implements a pure-JavaScript Office Open XML parser that reads cell values, formula results, and date and number types without any server component, so numbers stay numeric, dates become ISO 8601 strings, and formulas yield computed results rather than the formulas themselves. The conversion turns rows into objects keyed by the header, so whether the first row is truly the header and whether it contains merged cells decides whether keys line up correctly. The tidy JSON feeds directly into API integration, database imports, or frontend visualization. Files are parsed entirely in your browser and never uploaded, so commercial or customer data stays private. How headers map into structure is the first decision to settle. One header row can produce a flat set of keys or split by delimiter into nested levels; the flat form is easier downstream while the nested one matches real semantics but demands fixed paths. Choose by the consumer rather than by which looks neater, and standardise it so one dataset is not exported two ways. Type inference is where silent errors most often arise. Cells carry no strict type information, numbers look like text and dates are an underlying serial value. Declare the target type per column: inferring from content is convenient but may turn an identifier into a number or strip a leading zero, while explicit per-column typing is more work yet predictable, and worth it for key fields. Empty cells have two meanings and mixing them breaks downstream logic. Absence may be an explicit null or an omitted key, the former meaning the field exists without a value and the latter that it does not apply. Confirm how the consumer detects absence, especially in business logic distinguishing zero from not filled in, since this affects the statistics directly. Multi-row and merged headers need normalising first or the structure misaligns. Real sheets often have two header rows, a broad category plus a subtype, or merged cells creating levels, and taking the first row as keys couples every later column to the wrong meaning. Flatten into a single header row and join category and subtype into one key before converting. The top-level shape also needs agreeing in advance, commonly an array of objects or an object keyed by primary key. An array preserves order and is easy to iterate for analysis, while a keyed object looks up faster but loses order and lets a later duplicate overwrite an earlier one. Where duplicates exist, decide on deduplication or switch to an array rather than assuming none occur. Finally, scale affects the method and usability. Up to a few thousand rows converts without strain, while at hundreds of thousands the output size and parse time climb noticeably, so consider chunked output or a format better suited to bulk. Check the row count before starting rather than discovering afterwards that the consumer cannot read it.
How It Works Internally
Export treats the header row as keys and the rest as records. Two things decide the result: whether headers are unique and non-empty, since a duplicate header makes the later column overwrite the earlier one, and type inference — because cells carry no type, numbers land as strings and dates follow their display format, so confirm a column holds plain digits before expecting a number.
Headers id, id (duplicated)The second column overwrites the first, leaving a single id key — make headers unique before exportingMeasured on This Page
| Object convention | First row as keys, one object per row — matching SheetJS sheet_to_json defaults (all three rows match key by key) |
|---|---|
| Missing cells | A blank cell produces no key (the 香蕉 “banana” row has no 备注 “remark” key) rather than null — downstream code should test '备注' in obj instead of comparing to null |
| Empty-string cells | A cell explicitly containing an empty string appears as "" — the file has the cell but no value; 'key missing' and 'key present but empty' are different and both are preserved |
| Number types | Numeric cells come out as numbers (3, 7, 0), not strings |
| Sheet switching | Switching to Second yields [{"x": 1}] — switching really re-converts |
The output is an array of one object per row keyed by the first row — convenient for programs, with two consequences: headers must be unique or same-named columns overwrite each other, and blank cells produce no key so objects in the array may have differing key sets — iterate with 'in' checks rather than assuming a key exists. 'Key missing' and 'empty string' are different: in the measured 3-row sheet the third row's name cell was absent and no key appeared, while a cell explicitly containing "" shows up as "" — handle the two cases separately when cleaning data.
How to Use
- Open "Excel to JSON"
- Upload a spreadsheet; the first row becomes field names
- Switch worksheets with the dropdown for multi-sheet files
- A JSON array of rows is produced automatically
- Click copy to take it into an API payload or config
Use Cases
- API data integration — Convert Excel data from business teams to JSON for direct use as API request bodies or response data.
- Database import — Transform customer or product data in Excel to JSON for batch import into MongoDB or PostgreSQL via scripts.
- Config file generation — Convert Excel-maintained configuration parameter tables to JSON config files for frontend or backend loading.
- Data migration — Convert legacy system Excel exports to JSON intermediate format for migration to new system data structures.
- Frontend visualization — Convert Excel data to JSON for direct rendering by chart libraries like ECharts or D3.js.
- API test fixtures — Turn test cases from Excel into JSON arrays to use as input data for API automation tests.
FAQ
What Excel file formats are supported?
It supports xlsx (Office Open XML), xls (BIFF8), and csv formats. The SheetJS parser auto-detects file type and parses correctly.
Can it handle multiple worksheets?
Yes. The tool lists all worksheet names in the file; you can select a specific sheet or convert all sheets one by one.
Are date and number types preserved?
Yes. SheetJS recognizes Excel date serial numbers and converts them to ISO 8601 strings; numbers remain numeric type, not strings.
What if the first row is not a header?
Use header row positioning to point at the real header row; if the header is made of merged cells, unmerge or restructure it first to avoid missing keys.
Does it support merged cells?
Merged cell values use the top-left cell value; other positions are empty. Unmerge or adjust data structure before conversion for best results.
Are the files uploaded to a server?
No. All parsing runs locally via SheetJS and the content never leaves your device, safe for spreadsheets with commercial secrets.
Numbers come out as strings in the exported JSON. Why?
Spreadsheet cells carry no type, so dates, identifiers with leading zeros and very long numbers all tend to export as strings, and a value containing a thousands separator is treated as text. Confirm the source column holds plain digits with no separator before expecting a number, settle the date format, and where it matters format the column as text or number in the sheet to distinguish a numeric value from an identifier.
Do empty cells become null or empty strings in the JSON?
It depends on the option, and the semantics differ: null means "no value" while "" means "present but empty". Confirm which one the target API expects — mixing them is a common cause of validation failures.