JSON to CSV: keep identifiers, commas and empty cells intact

JSON to CSV: keep identifiers, commas and empty cells intact

A reproducible two-row example, field checks and spreadsheet import precautions.

Updated · 2026-11-25

You need a spreadsheet from a JSON export, but an identifier such as 001 must remain text and a comma inside a name must not create another column. This walkthrough follows one small dataset through validation, conversion and import. Use fictional records first; repeat the checks on a copy of your real file.

JSON to CSV: keep identifiers, commas and empty cells intact
Illustration of the workflow; example values are explained below.

Prepare a flat, consistent dataset

The lris converter expects a non-empty array of objects. Every record must contain the same field names. The first record sets the column order; a later record may list those keys in another order. Nested arrays and objects need a deliberate flattening step before conversion. Do not turn an address object into an unreadable string merely to silence an error.

[{"id":"001","name":"Tea, green","note":"She said \"Hi\""},{"note":null,"name":"Coffee","id":"002"}]

Validate, format and convert

  • Paste the sample into JSON Validator. If it reports an error, fix the JSON syntax before continuing. For example, a trailing comma after the final property is invalid JSON.
  • Use JSON Formatter to inspect both records. Confirm that id values have quotation marks and that the field names match. Formatting improves readability; it does not repair missing fields or change the intended data model.
  • Copy the validated array into JSON to CSV and convert it. Compare the header and each cell against the result below; cosmetic quoting of ordinary cells can vary.
id,name,note
001,"Tea, green","She said ""Hi"""
002,Coffee,

Import the CSV without losing leading zeros

CSV stores text separated by delimiters; it does not carry spreadsheet column types. Use your spreadsheet import dialogue and set the id column to text before loading it. Opening the file directly may let the spreadsheet infer a number and display 001 as 1. If this happened, changing the cell format afterwards may not restore the original value; import the original CSV again.

Check the result and understand the limits

  • There must be three columns and two data rows. Tea, green must occupy one cell. The quoted word Hi must keep its quotation marks inside the note cell.
  • The second note is blank. This converter represents null as an empty cell, so CSV cannot distinguish null from an empty string. Keep the JSON source if that distinction matters.
  • If one record lacks note, add note with null when that matches your data meaning. If it has an extra field, decide whether all rows should gain that field rather than silently dropping it.

When to use a different workflow

Keep JSON when you need nested structures, explicit null values or a lossless round trip. For a large export, first compare a small representative sample containing commas, quotes, non-Latin text and empty values. A successful conversion alone does not prove that the imported spreadsheet preserved every value.

Technical references

Continue with another guide

Cookie
We care about your data and would love to use cookies to improve your experience.

Learn how we use cookies