Tabular JSON and CSV
JSON and CSV both carry row-oriented data, but they model it differently. JSON keeps structure in the parse tree—objects, arrays, typed scalars, nesting. CSV is a text table: one header row of field names, then delimiter-separated cells per record. A JSON array of objects maps naturally to CSV; arbitrary JSON (deep trees, mixed types in one column) does not have a universal spreadsheet shape.
Conversion here is lossy in the spreadsheet sense: extra columns appear when objects disagree on keys; nested objects become opaque cell text unless you flatten first. For binary Excel workbooks (.xlsx), export or upload via Excel to CSV and paste the text, or stay in the spreadsheet toolchain.
JSON ↔ CSV — background
Object arrays as tables
Each plain object becomes one row. Property names become column headers; the union of keys across rows defines columns (first-seen order). A single object is a one-row table. Arrays of primitives become rows with a value column; arrays of arrays become c1, c2, … by position. This is the same logical model SQL COPY, pandas read_json, and many API “export CSV” endpoints use.
Quoting and delimiters (RFC 4180 style)
Fields that contain comma, quote, or newline must be double-quoted; internal quotes are doubled. Exports from this tool use comma separators and UTF-8; downloads include a BOM so Excel recognizes UTF-8. On import, the first line counts commas, semicolons, and tabs outside quotes to guess delimiter—common for Excel locale exports (semicolon in EU, tab from copy-paste).
Nested JSON inside a cell
When a field value is an object or array, JSON→CSV stores JSON.stringify(text) in that cell, quoted. CSV→JSON parses quoted cells that look like {…} or […] back into structured values. That round trip is intentional for light nesting (metadata blob, tags array). Deep hierarchies are usually flattened (JSON flatten) or kept in JSON end-to-end.
Types when reading CSV back
Unquoted cells are interpreted: null, true, false as literals; numeric strings as numbers; everything else stays string. Quoted cells remain strings even if they look numeric—important for leading zeros (SKU "007") and IDs. Excel often forces text by prefixing apostrophe; pasted CSV may still need quotes to preserve type on import to JSON.
Where conversion fits
API payloads into spreadsheets
Log or REST responses as JSON arrays are easy to inspect as CSV in Sheets or Excel for ad-hoc analysis, pivot tables, or handoff to non-developers—provided columns are flat enough.
Spreadsheet edits back into code
After manual column edits, CSV→JSON yields a JSON array you can diff, schema-check (JSON Schema validator), or POST again. Pretty-print with JSON formatter when readability matters.