Skip to content

Browser tool

Convert CSV or TSV to JSON

Keep the spelling of each cell as you convert a small table. Choose named fields for regular rows or arrays when the position of each cell matters.

Convert CSV to JSON

Paste CSV text and choose an output format. Conversion runs in this tab. Cell values stay strings, including surrounding spaces, leading zeros and decimal places.

The output includes your actual cell values. Row objects repeat the header names for each data record, so a download can be larger than the CSV.

Each excerpt can contain up to 100,000 UTF-16 code units, 2,000 data records and 64 fields per record.

Choose the delimiter used in the excerpt. Put fields containing a delimiter or line break in double quotes. Double any quote inside a quoted field. Use one record separator throughout. The browser may turn pasted line endings into LF. The tool reads the text in the box.

0 / 100,000
Output format

Each data record becomes an object keyed by its headers. Headers must be distinct and nonblank. Each record must have exactly as many fields as the header. Keys are written in source order. JSON readers may display them in another order.

The matrix stores a format identifier, columns (the header array) and rows (one array per data record). It preserves duplicate or blank headers and the actual width of each row, including trailing empty fields.

Enable JavaScript to use this tool in this tab.

Choose the separator used in the source

Paste the headings and the rows beneath them. Select comma, tab or semicolon, then choose the output mode. In the fictional example, the comma inside “Dock, two” belongs to the note. The quotation marks around that field keep the note together.

Use row objects for named fields

Choose Row objects and select Convert to JSON. Each data record becomes an object whose property names are the headings. The example gives order_id the string value "0007" and amount the string value "12.30". An empty final note appears as an empty string.

A blank or repeated heading makes the keys ambiguous. An uneven row leaves the correspondence between names and fields incomplete. Row objects mode requires unique, nonblank headings and the same number of cells in every row as in the header. Names such as 2 and __proto__ are written as literal JSON property names.

Use a matrix to retain positions

Choose Table matrix if the source has two columns with the same name, an unnamed column or rows of different lengths. The output stores the headings once in columns and the data in rows. Count the elements of a short row before deciding what, if anything, belongs in the missing position.

With a valid header and zero data rows, row objects mode produces an empty array, []. Use a matrix to keep the headings in an empty table. Its columns array also keeps the column order explicit when another program reads the JSON.

Inspect the download

Both modes run on the pasted text in this browser. The JSON includes the cell contents. Check a code with leading zeroes, an empty cell and a row containing punctuation before sharing the output. Each paste accepts up to 100,000 UTF-16 code units, 2,000 data records and 64 fields per record.

Continue with a check