Turn CSV into a JSON array of objects, with type detection.
Uses of CSV to JSON
- Converting a spreadsheet export into a JSON array for a web app
- Turning a database CSV dump into JSON for an API request
- Seeding JavaScript fixtures or mock data from a CSV file
- Reshaping a CSV report into JSON for a charting or visualization library
- Loading tab-separated values from a tool export into a JSON pipeline
CSV to JSON pitfalls
- Omitting the header row that names the columns
- Expecting numeric strings with leading zeros to become numbers
- Choosing the wrong delimiter for semicolon or tab separated files
- Forgetting to quote fields that contain the delimiter
CSV to JSON questions (8)
What CSV format does the converter expect?
The converter expects the first row to be a header row listing the column names, with one data row per line beneath it. For example, a file starting with name,age followed by Alice,30 produces [{"name":"Alice","age":30}]. Each header becomes a key and each row becomes one object in the resulting JSON array.
How does type detection work?
With "Detect types" enabled (the default), the converter coerces cells that look like numbers, booleans, or null into real JSON types: 30 becomes the number 30, true becomes a boolean, and null becomes JSON null. Everything else stays a string. Turn the option off to keep every value as a string, which is useful when you need a lossless, predictable result.
Why is a value like 007 kept as a string?
Numbers with leading zeros, such as zip codes, product codes, and phone extensions, would lose their zeros if converted to a numeric type (007 would become 7). To prevent silent data loss, the converter keeps any leading-zero value as a string even when type detection is on.
How are commas and quotes inside a field handled?
The converter follows RFC 4180 quoting rules. A field wrapped in double quotes can contain commas, line breaks, and escaped quotes (written as two double quotes, ""). For example, "Smith, Jr." is read as the single value Smith, Jr. rather than two columns.
Can I use a delimiter other than a comma?
Yes. The delimiter control lets you choose comma, semicolon, tab, or pipe. Semicolon files are common in locales where the comma is the decimal separator, and tab-separated values (TSV) are common in exports from spreadsheets and databases.
What happens if a row has fewer values than the header?
Missing trailing values are filled with an empty string for the corresponding columns, so every object has the same set of keys. This keeps the JSON array uniform and safe to iterate over without checking for undefined keys.
Can I convert the JSON back to CSV?
Yes. Use the JSON to CSV Converter, the sibling tool in this workspace. Switch direction with the pill above the editor and your result carries straight over, so you can round-trip between CSV and JSON without copying and pasting.
Is my data sent to a server when I convert?
No. All conversion happens in your browser using JavaScript. Your CSV data never leaves your machine: there is no upload, no server-side processing, and no logging of what you convert. This makes the tool safe to use with internal or sensitive data.