CSV to JSON converter
Paste CSV to get JSON, or JSON to get CSV, with quoted fields, embedded commas and embedded newlines handled per RFC 4180. Runs locally, so customer data stays on your machine.
Runs in your browser — nothing is uploadedWhy splitting on commas fails
A CSV field may be quoted, and a quoted field may contain commas, newlines and
escaped quotes written as two double quotes. Any parser built on split(',') is wrong for
real data, and wrong in a way that shifts every subsequent column.
The things CSV does not specify
There is no standard for the delimiter, which is a semicolon across much of Europe where the comma is a decimal separator. Nor for the encoding, the line ending, whether a header row exists, or how to express null as distinct from empty. Any of these can differ between two files both correctly called CSV.
Formula injection
A cell beginning =, +, - or @ is treated as
a formula when the file is opened in Excel or Sheets, which can execute on the opener's machine. If you export
CSV containing user input, escape those leading characters.
Questions
Why does my CSV parser break on quoted fields?
Because it is splitting on commas. A quoted field can legitimately contain commas and newlines, so the file has to be parsed rather than split.
My CSV uses semicolons. Is that valid?
Yes. There is no standard delimiter, and semicolons are normal in locales where the comma is the decimal separator. Detect the delimiter rather than assuming.
What is CSV formula injection?
A cell starting with =, +, - or @ is interpreted as a formula by spreadsheet software and can run on the machine that opens it. Escape leading characters when exporting user-supplied data.
Why does Excel show my first column name with a strange character?
A UTF-8 byte-order mark that was not stripped. It becomes part of the first header name.