Convert CSV to an array of JSON objects

  1. Select CSV to JSON and choose the actual delimiter between comma, semicolon, and tab.
  2. Paste data with column names in the first row or load a UTF-8 file.
  3. Select Convert, then check the output keys and values.
  4. Copy the JSON or download it as a file.

Column names in the first row cannot be empty or duplicate. All rows must have the same number of columns as the first row. This tool does not automatically guess numbers, dates, or booleans; it preserves CSV values ​​as strings. Leading and trailing spaces are also part of the value.

id,name
001,Alice
002,Bob

The result for the first row of data is:

{"id":"001","name":"Alice"}

Empty cells result in an empty string. If you change a code like 001 to a number, the leading 0 disappears, so it is better to keep the identifier as a string. Other programs can also convert string values ​​within a JSON file, so check the final processing rules.

Processing commas, double quotes, and line breaks within cells

Enclose a CSV field in double quotes when it contains a comma or line break, and double any quotation mark inside it. The example below has two columns; the name value is Alice, Kim.

id,name
001,"Alice, Kim"

The CSV field "He said ""Hello""" decodes to one cell containing He said "Hello". A line break inside quotes stays in the same cell; outside quotes it starts a new record. Splitting the input into lines and then splitting on commas will not correctly parse these cases.

This tool reads CRLF·LF·CR line breaks and does not create an extra blank line with a single line break at the end of the last line. Blank lines in the middle are treated as records, so an error occurs if the number of columns is different. Characters that do not meet strict input rules, such as spaces after closing quotes, are rejected. TSV and semicolon delimitation are also supported by this tool, which enforces the same quoting rules, and does not mean that it is the same as the TSV dialect in all programs.

Note: CSV format description in RFC 4180. This document is an informational document that summarizes commonly used CSV practices.

What happens to columns and empty values when exporting JSON?

Input must be an array of objects. For example, [{"id":"001","active":true},{"id":"002","note":"memo"}]. It collects the keys of all objects to create a column, using the order of the first key encountered, based on the order in which keys are enumerated in JavaScript. Integer-shaped keys may be enumerated in a different order than regular string keys.

Missing keys, null, and empty strings all become empty CSV cells. CSV alone cannot recover which of the three the original JSON contained. Booleans are exported as the literal text true or false; numbers retain their original JSON notation. When this tool converts the CSV back to JSON, every cell becomes a string, so original data types are not restored.

The following round trip uses synthetic data. In the first row, note is null; the second row has no note key; the third has an empty string. All three become empty CSV cells. Reading the CSV back produces objects whose note value is an empty string. If these differences matter to your workflow, keep the original JSON or record the state in a separate column before exporting. This tool does not guess the original state.

[{"id":"001","note":null},{"id":"002"},{"id":"003","note":""}]
"id","note"
"001",""
"002",""
"003",""

Nested objects and arrays are not supported. Flattening an address into columns such as address.city requires rules specific to your data. JSON numbers are written to CSV exactly as entered, including 9007199254740993, 1.00, -0, and 1e400. A spreadsheet may reinterpret those values; import identifier and precision-sensitive columns as text. Duplicate keys within one object cause an error so no value is silently discarded. Rename the keys and convert again.

RFC 8259

CSV encoding, UTF-8 BOM, and spreadsheet formulas

File import supports UTF-8 only. Convert files in other encodings, such as CP949 or EUC-KR, to UTF-8 first. The CSV download BOM option prepends the UTF-8 signature bytes to the file. This may help an application detect the encoding, but it does not fix every import setting. The preview and copied text have no BOM, and JSON downloads have no BOM either.

CSV is not an XLSX file, which preserves cell data types, colors, fonts, or multiple sheets. When opened in a spreadsheet, 001 may be replaced with the number 1 or interpreted like a date. Specify the identifier column as text in the program's import screen and see the actual result.

The apostrophe option is enabled by default. It prepends an apostrophe to strings and column names that begin like formulas, including those starting with =, +, -, or @. This changes the data and is intended to reduce formula interpretation risks. Negative JSON numbers are handled differently from strings. Check the content and import settings for untrusted data; this option does not guarantee safety across spreadsheet applications or save-and-reopen workflows. Disable it only when you understand the effect on an export that must preserve the original text.

For the synthetic input [{"n":-5,"s":"-5","f":"=1+1"}], the default option leaves the n cell as -5 and prepends an apostrophe to both s and f. The reported apostrophe count is 2. If you read the CSV back with this tool, the apostrophes remain in the strings. Quoting a cell for CSV syntax is separate from spreadsheet formula interpretation. A spreadsheet may remove this protection when saving and reopening a file, so do not treat the export as verified safe.

Security Note: OWASP CSV Injection.

Size limits and troubleshooting

Input is limited to 2 MiB of UTF-8 data, 10,000 data rows, and 100 columns; output is limited to 8 MiB. JSON repeats key names for each row and can be larger than CSV. Split the input if the output exceeds the limit. Processing happens in your browser; refreshing clears the input and result.

If row lengths differ, check the delimiter, quoted values containing commas, and blank lines. Loading a JSON, CSV, or TSV file sets the conversion direction from its extension. TSV selects tabs; check the comma or semicolon delimiter yourself for CSV. TXT files keep your current settings. Use the JSON Formatter and Validator to locate syntax errors. Conversion does not validate API-required fields or business rules. Keep the source file and compare row counts, column counts, and sample values with the output.

Column count errors show the expected and actual number of columns. For quote or column count errors, check the line and record numbers, then select Go to problem. A line is a physical line of text; a record is a CSV row, counting the header as record 1. A quoted cell can contain line breaks, so these numbers may differ. Editing the input clears the previous error and output. Convert again after making corrections.

Frequently Asked Questions

Automatically convert numbers in CSV to JSON numbers?

No. Keep all cells as strings. This is a method to avoid random changes to identifiers such as 001 or long numeric strings.

Can I also upload Excel XLSX files?

Not supported. Export the required sheets from the spreadsheet as UTF-8 CSV and use them.

Is the data exactly the same when I round-trip between CSV and JSON?

This is not always the case. The distinction between null, missing key, and empty string and the JSON data type cannot be restored with a CSV round trip. Turning on the single quote option will also change that string.