CSV to JSON Converter

Convert CSV into JSON, and JSON back into CSV.

Developer Tools Free, no sign-up Runs in your browser

CSV to JSON Converter tool

Direction
—

About the CSV to JSON Converter

CSV to JSON Converter moves tabular data between the two formats people actually exchange it in. Paste a block of CSV copied from a spreadsheet and get an array of JSON objects, one per row, keyed by the header line. Switch direction and an array of JSON objects becomes CSV ready to open in a spreadsheet.

Real CSV is messier than it looks, and the parser handles the awkward parts rather than splitting naively on commas. Fields wrapped in quotes can contain commas, line breaks and escaped quotes, and all of that survives the trip. You can set the delimiter to a semicolon or a tab for data exported from European spreadsheets or from a database, and choose whether the first row is a header.

Numbers and the words true and false can optionally be converted to real JSON types rather than left as strings, which is usually what you want when the output is going into code. Converting back to CSV writes a header row from the keys found across all records and quotes any value that needs it.

How to use the CSV to JSON Converter

  1. Choose a directionCSV to JSON, or JSON to CSV.
  2. Paste your dataA block of CSV copied from a spreadsheet, or an array of JSON objects.
  3. Set the optionsDelimiter, whether the first row is a header, and whether to convert numbers and booleans to real types.
  4. Convert and copyThe result appears below, ready to copy or download.

Features

  • CSV to JSON and JSON to CSV in one tool
  • Correct handling of quoted fields containing commas, quotes and line breaks
  • Comma, semicolon, tab and pipe delimiters
  • Optional header row
  • Optional conversion of numbers and booleans to real JSON types
  • Pretty-printed or compact JSON output
  • Reports how many rows and columns were converted
  • Copy or download as .json or .csv

Who uses this tool

The csv to json converter is used by writers, developers, students, marketers and anyone else who needs the job done once without installing software. Common cases include:

  • Turning a spreadsheet export into seed data for an application
  • Preparing a JSON fixture from a list someone sent you
  • Converting an API response into something a spreadsheet can open
  • Checking that an exported file parses the way you expect
  • Reshaping data between two systems that disagree on format

Frequently asked questions

How are commas inside a field handled?

A field wrapped in double quotes can contain commas, line breaks and quotes, exactly as the CSV convention allows. A doubled quote inside a quoted field is read as a single literal quote. Splitting naively on commas is the usual cause of corrupted imports and this parser does not do it.

What happens if rows have different numbers of columns?

Missing values become empty strings and extra values are given generated keys, so no data is silently dropped. The row count and column count reported after conversion will show you when something is uneven.

Should I convert numbers to real types?

Usually yes when the JSON is going into code, so that 42 arrives as a number rather than a string. Leave it off when values such as postcodes, phone numbers or product codes have leading zeros that must be preserved.

My European export uses semicolons. Will it work?

Yes. Set the delimiter to semicolon. Spreadsheets in locales that use a comma as the decimal separator export semicolon-delimited files, which is why a plain CSV parser mangles them.

What does JSON to CSV do with nested objects?

Nested values are written as JSON text inside the cell, because CSV has no concept of nesting. Flatten the structure first if you need nested fields as separate columns.

Is my data uploaded?

No. Parsing and conversion happen in your browser, so customer lists and exports containing personal data stay on your device.

If the csv to json converter is not quite what you need, these other free tools solve closely related problems.

JSON Formatter

Pretty-print and validate JSON, with the exact line and column of any error.

Developer Tools Use tool

JSON Minifier

Strip whitespace from JSON and compare original and minified sizes.

Developer Tools Use tool

Text Sorter

Order any list A-Z, Z-A, by number, by line length, or simply reverse it.

Text Tools Use tool

Remove Duplicate Lines

Deduplicate any list of lines, with case-sensitive and empty-line options.

Text Tools Use tool