Converters/CSV / JSON

CSV / JSON

Tabular data to records and back

First row is treated as the header.
CSV — input0 chars
JSON — output

CSV looks like the simplest format there is until you meet a value containing a comma, a quotation mark or a newline. RFC 4180 describes the common conventions — wrap such fields in double quotes, and double any quote inside them — but it is a description of practice rather than a standard everyone follows, which is why CSV files from different systems disagree in small, expensive ways.

Converting to JSON gives each row an explicit shape, with the header row becoming keys, so downstream code stops counting columns. Going the other way flattens records back into a grid for a spreadsheet or a bulk import. Both directions happen in this tab, which matters when the file is an export of something you would rather not upload.

How to use it

  1. Paste the CSV or the JSON arrayJSON input should be an array of objects; each object becomes a row and the union of their keys becomes the header.
  2. Set the delimiterComma is the default, but semicolon is standard in locales where the comma is the decimal separator, and tab-separated files are common from databases.
  3. Say whether the first row is a headerWith a header, keys come from it. Without one, fields are numbered so you do not silently lose your first record.
  4. Check the awkward rowsQuoted fields containing commas or line breaks are the ones that break naive parsers. Look at those specifically before trusting a large conversion.

Frequently asked questions

How are commas inside a value handled?

The field is wrapped in double quotes, and any double quote inside it is written twice. So a value of 5" pipe, threaded becomes "5"" pipe, threaded". Splitting a CSV line on commas without honouring quoting is the single most common CSV bug, and it fails silently on exactly the rows you care about.

Why does Excel mangle my CSV?

Excel applies locale rules and type inference on open. It reads semicolons as separators in many European locales, converts anything date-shaped into a date, and strips leading zeros from things like postcodes and product codes. Importing through the text import wizard, rather than double-clicking the file, is the way to keep control.

What line endings should a CSV use?

RFC 4180 specifies CRLF, and Windows tooling generally expects it, while Unix tools emit LF. Most parsers accept either. The case that genuinely matters is a line break inside a quoted field, which is legal and which line-by-line processing will split incorrectly.

How do nested JSON objects convert to CSV?

They cannot, directly — CSV is flat. The usual approaches are to flatten nested keys into dotted column names, or to serialise the nested value into a single JSON-encoded column. Either way it is a lossy translation, and arrays of differing length across rows have no good answer at all.

What is a byte order mark and why does it break my first column?

Some tools, Excel included, prefix UTF-8 files with three invisible bytes marking the encoding. A parser that does not strip them turns your first header into something like \ufeffid, so lookups by name silently miss. If your first column alone behaves oddly, that is usually why.

Related tools

Nothing left this tab. No request was made, no history was written. Converters · CSV / JSON