DevTools Pro · All tools · About

CSV to JSON Converter

About the CSV to JSON Converter

This CSV to JSON converter parses CSV or TSV data into a JSON array, using the header row as object keys. It handles quoted fields, detects numbers and booleans, and can rebuild nested objects from dotted column names, all in your browser.

How CSV parsing works (RFC 4180)

CSV looks simple, but a value can contain the delimiter, a line break or quotes. RFC 4180 solves this by wrapping such fields in double quotes and doubling any quote inside them. "New York, NY" is one field, and "Said ""hello""" decodes to Said "hello".

This parser follows those rules. It accepts LF, CRLF and old Mac CR line endings, skips blank lines, and ignores a UTF-8 byte-order mark at the start of the file. An opening quote that is never closed is reported with the line where it started.

Type detection: strings, numbers and booleans

Every CSV value is text. With Detect numbers & booleans on, 42 and 3.14 become numbers, true and false become booleans, null becomes null, and a cell holding [1,2] or {"a":1} is parsed as JSON.

Values that would change if converted stay as strings. A ZIP code like 007 keeps its leading zeros, and an ID such as 12345678901234567890 is too large for a JavaScript number, so it remains "12345678901234567890". Turn detection off to keep every value as a string.

Nested JSON from dotted headers

With Nest dotted keys on, a header like address.city creates a nested object: {"address": {"city": "London"}}. This is the reverse of the flattening that most JSON to CSV tools apply.

If a dotted name clashes with a plain column of the same prefix, the value is kept flat under its full name so nothing is overwritten.

How to Use the CSV to JSON Converter

  1. Paste CSV into the CSV box, click Upload to open a .csv, .tsv or .txt file, or click Sample.
  2. Set the Delimiter to Comma, Semicolon, Tab or Pipe. For a .tsv file, choose Tab.
  3. Leave First row is header on to get objects keyed by column name, or turn it off to get an array of arrays.
  4. Toggle Detect numbers & booleans and Nest dotted keys (a.b) to control value types and nesting.
  5. Review any yellow warnings, then Copy the JSON or Download it as data.json.

Frequently Asked Questions

Is my CSV file uploaded?
No. Uploaded files are read with the browser's File API and converted locally. Nothing is sent to a server.
How do I convert a CSV that uses semicolons?
Set the Delimiter to Semicolon. Excel in many European locales saves CSV this way because the comma is used as the decimal separator.
Why is my number still a string in the JSON?
Either Detect numbers & booleans is off, or the value would change as a number: leading zeros like 0123 and integers beyond 2^53 are kept as strings on purpose.
What happens when a row has missing columns?
The missing cells become null (or an empty string when type detection is off), and a warning lists the affected line numbers.
Can I get an array of arrays instead of objects?
Yes. Turn off First row is header and every row, including the first, becomes an array of values.
Can I convert Excel (.xlsx) files?
Not directly. Save the sheet as CSV in Excel or Google Sheets first, then upload the CSV here.

Related tools