JSON ↔ CSV
Turn a list of records into a spreadsheet and back, quoting and all.
Result
Good to know
- Columns are the union of every key that appears, in the order they were first seen, so a field that only some records carry still gets a column instead of being dropped.
- Values containing the separator, a quote or a line break are quoted, and quotes inside them are doubled — which is what a spreadsheet expects.
- Nested objects and arrays are written into the cell as JSON, because a spreadsheet has nowhere else to put them.
- Coming back the other way everything is text: CSV carries no types, so numbers arrive as strings and are yours to convert.
34 views