Documents & OCRPractical guides

JSON to Excel without changing long IDs: check two sheets, cell types and a quantity total

Long order IDs and quantities both look numeric, but should not share an automatic type decision. This complete downloadable case checks numeric spellings in two worksheets, then uses a separate CSV route to type only quantity and verify 2+3=5. Long IDs stay text; malformed input and lost null distinctions have explicit checks too.

A calculator on a table, illustrating numeric text and calculation types
Illustrative photo: Behnam Norouzi · Unsplash License

What changed: Expanded the original long-ID case with a complete two-sheet JSON pack, malformed-input recovery and a runnable typed-quantity route, including cell-type and null-loss checks.

The practical answer

KitNelo’s JSON-to-Excel route writes number lexemes as text, including prices and quantities, preserving long IDs, 1.2300 and 1e3. This input produces two orders and one meta row. For calculation, use CSV to Excel separately, keeping id Text and setting only quantity to Number. Null and empty strings both become blank cells, so the workbook cannot reconstruct the original JSON.

A sample you can reproduce

Two fictional store CSVs, eight records. After aligning headers and cleaning amounts: Oct 1–7 = 3,000; Oct 8–14 = 3,600; change = +20%. No records need deduplication in this sample.

The ZIP includes the field mapping, date ranges and expected totals. Files are synthetic; no account is needed.

Valid JSON numbers can exceed ordinary floating-point precision

RFC 8259 on numbers describes precision limits that affect interoperability. Common double-precision implementations have a bounded exact-integer range. An upstream system should generally represent an identifier as a string, while an existing numeric token still deserves preservation.

Do not round the value in an ordinary parser and expect the exporter to reconstruct its last digit. This entry uses a parser that retains numeric text. If an upstream tool already changed an ID to 9007199254740992, it cannot infer that 9007199254740993 was intended.

Complete input: two orders and one batch-provenance record

The download includes orders.json, a deliberately malformed invalid-orders.json, quantity.csv for a separate calculation workbook, README and expected.json. The complete fictional orders.json appears below. Preserve its literal text; parsing and serializing it with ordinary floating-point numbers first can change IDs before conversion begins.

Both top-level values, orders and meta, are arrays, so this structure maps to two worksheets. The meta record describes the exercise batch; it is not a third order. Do not report 2+1 rows as three orders.

Complete orders.json

{"orders":[{"id":9007199254740993,"price":1.2300,"quantity":2,"tags":["red","new"],"note":null},{"id":9007199254740995,"price":1e3,"quantity":3,"tags":[],"note":""}],"meta":[{"batch":"PRECISION-28","source":"Fictional editorial exercise"}]}
Retain both long integers and the spellings 1.2300 and 1e3. Reference answers are not inputs.

Import, download and reopen both worksheets

Open Excel document tools, choose “JSON to Excel”, select orders.json and process the download. Reopen the actual XLSX. Expect orders and meta: two orders plus a header, and one meta row plus a header. The meta batch is PRECISION-28. The current converter builds columns from the union of record fields and leaves missing fields blank.

Inspect id, price, quantity, tags and note in orders. Compare complete characters and cell types using cell values or the editing bar; the displayed column width alone cannot establish precision. Both price and quantity are text. Do not assume SUM will treat these text cells as numeric measures.

Expected values and types in the two orders
FieldFirst rowSecond rowCheck
id90071992547409939007199254740995Both text, complete final digits intact
price1.23001e3Original spellings as text
quantity23Text, not numeric 2 and 3
tags["red","new"][]One text cell per array
noteBlank cellBlank cellNull and empty string no longer distinct

Run a separate calculation route: type quantity only

The JSON route has no per-column type selector. The pack therefore includes quantity.csv with just id and quantity from the same two orders. Open Excel document tools, choose “CSV to Excel”, import it, keep column 1 id as Text and change only column 2 quantity to Number. Process and download.

Reopen this separate XLSX. There should be two data rows with exact long IDs as strings and numeric quantities 2 and 3. In the recipient’s spreadsheet application, summing B2:B3 should give 5; editorial checks also read the exported cell types and independently verified 2+3. Whether price 1e3 should become 1000 is a separate business decision, outside this quantity exercise.

For a deliberate error check, set id to Number. The current CSV preview should report a precision risk and block processing. Restore Text before export. If an upstream system has already changed the final digits, recover from the authoritative original rather than guessing from a rounded value. TheCSV column-types guide covers the other type boundaries.

Complete quantity.csv

id,quantity
9007199254740993,2
9007199254740995,3
This separate calculation input requires text IDs, numeric quantities and a total of 5.

Check identity and arithmetic separately

Mistake

Convert every numeric-looking field and use a quantity total of 5 as proof that IDs are correct too.

Exercise method

Compare long IDs character by character as text. Type only quantity as numbers, then check two rows and a total of 5. Retain the JSON and text workbook.

A correct aggregate does not prove that record identifiers survived.

Recover from malformed JSON and account for nested or empty values

invalid-orders.json has an extra comma after the second quantity. Processing it should report a JSON-format error. Reload the correct orders.json, then verify two orders and one meta row again. Do not delete the second order to obtain a success message, or interpret a failed conversion as zero orders.

Each tags array occupies one cell rather than expanding into tag rows; even[] remains text. The null note and empty-string note become blank cells, as missing fields can too. expected.json records this loss. If those states affect review, add explicit status fields upstream or choose a type-preserving workflow, and retain the original JSON.

Multiple sheets do not create relationships, foreign keys or one-to-many joins. Design parent keys and child tables before flattening nested structures. TheCSV/JSON round-trip guide offers another structural check; it does not establish a lossless round trip for this XLSX.

A handoff ledger for two text sheets and a calculation copy

Retain orders.json, its text-preserving XLSX, quantity.csv and the separate typed workbook, stating each file’s role. This example maps to two sheets because every top-level object value is an array. Other shapes do not automatically imply business tables, and Excel naming limits can require sheet-name cleaning or truncation.

Editorial acceptance read actual downloaded sheet names, row counts, cell values and types, and exercised malformed input and precision-risk recovery in both tool languages. These checks do not cover every large JSON, recipient application or nested structure. Browser memory still constrains parsing and workbook generation; test a representative small input first.

Require all of these handoff checks

  • Two order rows and one meta row; batch PRECISION-28 is not another order.
  • Both long IDs, 1.2300 and 1e3 retain their spellings; JSON-route quantity cells are text too.
  • Only quantity is numeric in the separate calculation copy:2 and 3 total 5 while IDs stay exact text.
  • Repair malformed source text rather than deleting a record to reduce the input.
  • Document the collapsed null/empty distinction, retain original JSON and do not promise a lossless round trip.

Reproduce the complete store-report workflow

The companion sample adds a cross-tool handoff exercise: keep ID 0011 as text, along with the comma and embedded newline in its note. The workflow carries actual results as JSON between tools, while the amount field is converted to numbers only after review. Opening the source CSV directly in Excel may infer a numeric ID; use its text/CSV importer and choose Text for identifiers. These short IDs complement the long-number precision example above.

Validate numbers and text separately after handoff. Summing amounts for October 1–7 and October 8–14, 2026 should give 3,000 and 3,600; IDs such as 0011 must remain text and notes must retain their newline. A +20% change checks the arithmetic, not identifier types. Inspect the exported file as well as the browser preview.

Common questions

Is “number stored as text” an export failure?

For this JSON route it reflects the deliberate numeric-text preservation strategy. Decide whether to convert a field from its meaning; avoid converting the whole workbook at once.

Will JSON dates automatically become Excel dates?

Do not assume so. JSON has no dedicated date type and usually carries dates as strings. This entry does not establish a time zone or date meaning from appearance alone.

Can exporting back to JSON reproduce the original exactly?

No. Blank distinctions, object key order, worksheet names and nesting can change. Keep the original JSON and define the XLSX as a reading or processing copy.

Further reading & sources

Put the guide into practice

Open the relevant tool, preview the result and check your exported file.

Newer articles on this topic

Continue with a newer article that refers to this guide or explainer.

Related articles