JSON and CSV: preserve meaning when moving data
A successful conversion is more than a file that opens. A product identifier must remain an identifier, a price a price, and missing data missing. Type and structure mistakes can pass without an error message.
Flat rows or nested data?
CSV suits rows and fields. JSON can represent typed values, lists and nested objects. If a record has multiple addresses or products, decide how to flatten them before exporting CSV. There is no single correct table shape for every structure.
References: IETF RFC 8259 — JSON Data Interchange Format · IETF RFC 4180 — Common CSV Format
Formatting and validation do different jobs
Pretty-printing JSON makes indentation easier to read; it does not prove a price or date is correct. Schema validation checks declared types and required fields, while application rules still determine meaning.
A quoted JSON string differs from a number. CSV fields containing commas or line breaks need appropriate quotation; quotation marks inside a quoted field are doubled.
References: IETF RFC 8259 — JSON Data Interchange Format · IETF RFC 4180 — Common CSV Format
Checks to make after conversion
Keep the original. Compare record counts and column names, then inspect both an ordinary record and one containing blanks, punctuation or multilingual text. Open the output in the actual receiving application; the converter cannot guarantee its import choices.
- Keep identifiers such as 0017 as text when the zeroes matter.
- Do not silently equate an empty value, null and 0.
- Use synthetic samples rather than credentials or real personal records.
- Handle untrusted CSV cautiously in spreadsheet software, which can interpret some cells as formulas.
Worked example: a comma inside a name
Original JSON: {"sku":"0017","name":"Notebook, blue","price":12.5}. In comma-delimited CSV, quote the product name: 0017,"Notebook, blue",12.5.
When importing, check that sku remains 0017 rather than 17 and that the product name does not split into two columns. Producing an output file alone does not prove either property.