Dev tools

JSON ↔ CSV

Convert a flat JSON array of objects to CSV and back. CSV has no type system: JSON->CSV renders numbers/booleans/null as text and CSV->JSON always comes back as strings. A nested object or array field is refused by name rather than silently flattened. CSV parsing is fully quote-aware, embedded newlines included; a file with an unterminated quote is refused rather than guessed at. Runs on your device.

Runs on your device. The file is never uploaded.

JSON to CSV writes a flat array of objects as rows under a header holding every key, in the order the keys were first seen. Switch mode to csv-to-json for the reverse. A field holding a nested object or array is refused by name, because one CSV row is one flat record, not a tree.

Input

Options

Questions

Which direction does it run?

Whichever you pick with the mode option, which defaults to json-to-csv. The other setting, csv-to-json, reads a CSV with a header row and gives back an array of objects. One tool, both directions, one file at a time or many dropped together.

Why was my nested field refused?

Because a CSV row models one flat record, not a tree. If a value is an object or an array the tool stops and names it, saying that row and field are "a nested object/array" and that this converter only handles flat rows. Flatten the field first, for example into a column named parent.child, and run it again.

Why did all my numbers become strings?

Because CSV has no type system. Going the other way, from CSV to JSON, there is no way to tell the text 36 from the number 36, so every value comes back as a string. Going from JSON to CSV, numbers, booleans and nulls are written as their plain text, with null becoming an empty cell.

Which columns end up in the CSV, and in what order?

The union of every key across every row, in the order they were first seen. A row missing one of those keys gets an empty cell rather than an error, so records with slightly different shapes still line up. A single JSON object rather than an array becomes one row.

Can it handle quoted fields with commas or line breaks in them?

Yes. Parsing tracks quote state across the whole file, so a newline inside a quoted field stays part of that cell instead of starting a new record, and a doubled quote is read as one literal quote. A file with an opening quote that is never closed is refused as an "unterminated quoted field" rather than guessed at.

Does the data leave my device?

No. Both directions run in a Web Worker in this tab, which is the point when the CSV is an export full of customer records or the JSON came from a live endpoint. There is no upload step, no account and no stored copy, and the page still works with the network switched off.

Related Dev tools