CSV to JSON Converter
Convert CSV to JSON and JSON to CSV, with quoted fields, comma, semicolon, tab or pipe delimiters, type inference and a preview of the table.
Preview
Pin tools here. They are saved in this browser.
Pin a tool and its sticker lands here.
Convert CSV to JSON and JSON to CSV, with quoted fields, comma, semicolon, tab or pipe delimiters, type inference and a preview of the table.
Preview
RFC 4180 describes CSV as records separated by line breaks and fields separated by commas. A field that contains a comma, a quotation mark or a line break is enclosed in double quotes, and a quotation mark inside it is written twice. The format has no types, so every value is text, and a file cannot say which delimiter or which character encoding it uses.
Real files vary. A spreadsheet program set to a region that writes decimals with a comma usually exports with semicolons, database tools often export with tabs, and line endings can be CRLF, LF or CR. This tool reads all of these, removes a byte order mark, skips blank lines and keeps a stray quotation mark inside an unquoted field as text.
With Auto-detect, the tool splits the first 20 rows with a comma, a semicolon, a tab and a pipe, and scores each one by the number of columns it gives and by how many rows have that same number. A delimiter that leaves quotation marks in the middle of a field scores lower. The preview shows the result, so a wrong guess is easy to see and to correct by hand.
With Infer types, an empty field becomes null, true and false become booleans, and a plain decimal number becomes a JSON number written exactly as it was, so 49.90 stays 49.90. Anything else stays a string, including values that only look like numbers: 007, +39 and 1e5 are more often codes than quantities.
A row with fewer or more fields than the header is still converted, and its line number is listed. In the array of objects, the missing keys are left out and the extra fields are named column_N after their position. A header cell that is empty gets the same kind of name, and a repeated name gets a suffix such as _2, so that no value overwrites another.
An array of objects becomes one row for each object. The header is the union of all the keys, in the order in which they first appear, and an object that lacks a key gets an empty field. A nested array or object is written into its cell as JSON text, and null becomes an empty field. An array of arrays is written row by row as it is.
Fields are quoted only when they contain the delimiter, a quotation mark or a line break. The downloaded file separates the records with CRLF, as RFC 4180 specifies.
No. The file is read by your browser and converted on your device. The tool makes no network request with it, and the site's security policy blocks requests to any other host.
JSON numbers cannot have leading zeros, and turning 007 into 7 would lose information in a postal code or a product code. The tool converts only plain decimal numbers. Turn off type inference to keep every value as a string.
Choose the delimiter yourself in the list. Detection looks at the first 20 rows and can be misled by a file with a single column or with very irregular rows. The line next to the preview title names the delimiter that was detected.
A field in double quotes may contain line breaks, and they become \n in the JSON string. The line numbers in the warnings are lines of the file, so after such a field they are higher than the row numbers.
It opens in its own window and keeps working offline.
To install it, tap the Share button, then “Add to Home Screen”.