Home › Text Tools › CSV and JSON Converter

CSV and JSON Converter

Convert CSV text to a JSON array, or a JSON array to CSV. Handles quoted fields, line breaks, and comma, semicolon or tab delimiters.

Direction
Delimiter (the character between fields)

CSV to JSON: the first row gives the keys of each object. JSON to CSV: when this is ticked, objects get a headings row. An array of arrays never gets one.

Ready.
Everything runs in your browser. Nothing you paste or type is sent anywhere or stored. Very large inputs can make the page slow.

How it works

CSV to JSON reads CSV in the RFC 4180 style. A field in double quotes can hold the delimiter and line breaks, and two double quotes inside it stand for one. Both LF and CRLF line endings work. Empty lines are skipped. With the box ticked, the first row gives the keys and each later row becomes one object. Without it, each row becomes an array.

JSON to CSV takes a JSON array of objects, or of arrays. The headings are every key that appears in any object, in the order first seen. A missing key or a null value gives an empty cell. Numbers and booleans are written as text.

Quoting rule. A field is quoted only when it contains the delimiter, a double quote or a line break. Each double quote inside a quoted field is doubled. All other fields are written as they are, so most CSV needs no quotes at all.

Formula safety. A value that starts with = + - @, a tab or a carriage return gets a single apostrophe in front, so a spreadsheet shows it as text instead of running it as a formula. A negative number is one example, so -2 is written as '-2.

Values come out as text. Nothing is turned into a number, so 007 stays 007 and true stays "true".

Refused input gets a message that says what is wrong and where: a quote that is never closed, a row with the wrong number of fields, a duplicate heading, text after a closing quote, JSON that is not an array of objects or arrays, or a nested object or array, which cannot fit in one cell.