TTKTheTextKit

CSV to JSON Converter

Paste CSV data below to convert it into a pretty-printed JSON array of objects. By default, the first row is treated as column headers. Toggle the option off to generate arrays instead of objects. The parser correctly handles quoted fields, commas within quotes, and escaped double quotes, not just a naive comma split. Pick comma, semicolon, tab or pipe as the delimiter, and switch on number detection if you want numbers and true/false instead of text.

Related Tools

[5 suggestions]

Guides for the CSV to JSON Converter

About the CSV to JSON Converter

The CSV to JSON Converter implements a proper RFC 4180 style CSV parser that handles the tricky edge cases a simple .split(',') approach cannot: fields wrapped in double quotes, commas appearing inside quoted values (e.g. "New York, NY"), escaped quotes within fields (two consecutive double quotes), and fields containing newlines. It also copes with the things real spreadsheet exports contain: a UTF-8 byte order mark at the start of the file, CRLF line ends, blank lines, and semicolon or tab separated files. Every value stays text by default, so a value like 007 keeps its leading zeros. The detect numbers and booleans option converts a column to JSON numbers or true and false only when every filled cell in it can be written that way without changing a digit. A column with 00510, 1.50 or a very large ID stays text, a column never mixes types, and empty cells in a converted column become null. A blank or repeated header gets a name (column_3, name_2) so no column is lost, a row with more cells than headers keeps the extra cells as column_4 and so on instead of dropping them, and a quote that is never closed gives an error that names the row. When the "first row as headers" toggle is on (the default), the parser uses the values from the first row as JSON object keys, and each subsequent row becomes a JSON object with those keys. When the toggle is off, each row is emitted as a plain JSON array. The output is pretty-printed with 2-space indentation, ready to paste into configuration files, API mocks, or data pipelines. Common use cases include converting spreadsheet exports for use in web applications, transforming database CSV dumps into API-compatible payloads, and preparing test fixtures for front-end development.

How does it handle commas inside CSV fields?▾

Fields containing commas must be wrapped in double quotes per the CSV standard (RFC 4180). The parser correctly recognizes quoted fields and preserves the comma as part of the value rather than treating it as a field separator.

What happens if rows have different numbers of columns?▾

If a data row has fewer values than headers, the missing fields are set to empty strings in the JSON output. If it has more, the extra values are kept under the names column_4, column_5 and so on, so no data is lost. Check the file if you see those names, because a stray comma in an unquoted field is the usual cause.

Why are my numbers written as text in the JSON?▾

By default every value is kept as text, because a CSV has no types and converting can change data: 00510 would lose its zeros and a long ID would be rounded. Switch on detect numbers and booleans to get JSON numbers and true or false for columns where every filled cell converts without any change.

Can I convert JSON back to CSV?▾

Yes. Use the companion JSON to CSV Converter on this site. It takes a JSON array of objects and produces CSV with a header row.