Skip to content

CSV to JSON Converter

Convert CSV data to a JSON array of objects with header mapping and automatic comma, semicolon, or tab detection.

CSV to JSON Converter tool

Loading...

Example

Input: name,age / Ada,36 / Alan,41 (3 lines)

Result: A 2-space indented JSON array: [ { "name": "Ada", "age": "36" }, { "name": "Alan", "age": "41" } ]

The first row supplies the keys and each later row becomes one object. Cell values are kept as strings, exactly as they appear in the CSV.

  1. Paste your CSV data, including a header row, into the CSV panel.
  2. The tool auto-detects whether the delimiter is a comma, semicolon, or tab and converts as you type.
  3. Check that each row appears as an object keyed by your header names, with values kept as strings.
  4. If a quoted field is not closed, fix the error shown below the panels and the JSON updates.
  5. Review the generated JSON output and click the copy button to use it in your project.

Turning CSV Rows into JSON Objects

This tool converts CSV into a JSON array of objects. The first row supplies the keys and each later row becomes one object, so name,age followed by Ada,36 becomes [{"name": "Ada", "age": "36"}].

You do not need to set a delimiter. Before parsing, the tool looks at the header line and counts the commas, semicolons and tabs that sit outside quotes. Whichever appears most is used. So exports from European versions of Excel, which often use semicolons, and tab-separated data copied from a spreadsheet both work as they are.

Every value stays a string. The number 36 comes out as "36", and a ZIP code like 01234 keeps its leading zero. That is deliberate, because guessing types breaks IDs, phone numbers and codes. Convert the fields you need in your own code. Short rows get empty strings for the missing cells, and blank lines are skipped. Spaces around unquoted values are trimmed, while quoted values are kept exactly as written.

Quoted fields follow RFC 4180. They can hold the delimiter, line breaks and doubled quotes (""), which stand for one quote character. If a quote is never closed, you get an Unterminated quoted field error instead of a wrong result. The panels also work in reverse, turning JSON back into comma-separated CSV. To start from a spreadsheet file, convert it first with Excel to CSV, and to check the result, open it in the JSON Formatter.

Sources

Frequently Asked Questions

The converter keeps every value as a string on purpose. CSV has no types, and guessing would turn a code like 007 into 7 or a long ID into a rounded number. If you need numbers or booleans, convert those fields after import, for example with Number(row.age) in JavaScript or int(row["age"]) in Python.
Yes. The delimiter is chosen from the header row by counting commas, semicolons and tabs outside quotes, and the most frequent one wins. Pipe-separated data is not detected, so replace the pipes with commas first. Make sure the header row uses the same delimiter as the data rows, since only the header is checked.
The first row is always used as the keys, so your first data row would become the field names. Add a line at the top with the names you want, such as id,name,email, and convert again. Each later row then becomes an object with those three keys.
A short row gets empty strings for the missing fields, so every object has the same keys. Extra cells beyond the last header column are ignored and do not appear in the JSON. If data seems to be missing, check for an unquoted comma inside a value, which splits one cell into two.
A JSON object can hold each key only once, so the later column overwrites the earlier one and only its value appears in the output. Rename one of the headers, for example to phone_home and phone_work, before converting.

Related Tools

JSON to CSV Converter

Convert a JSON array of objects to CSV with automatic column headers, and convert CSV back to JSON in the same tool.

Developer Tools

JSON Formatter and Validator

Format, validate, beautify, and minify JSON data with a collapsible tree view and line-and-column error detection.

Developer Tools

CSV to Excel Converter

Convert CSV files to downloadable .xlsx Excel spreadsheets instantly in your browser. No upload to any server required.

File Converters

Excel to CSV Converter

Parse .xlsx and .xls Excel spreadsheets to CSV format with sheet selection. All processing happens in your browser.

File Converters

JSON to YAML Converter

Convert JSON documents to YAML format with syntax validation, clean formatting, and instant preview.

Developer Tools

JSON to XML Converter

Convert JSON data to well-formed XML documents with customizable root element and formatting options.

Developer Tools