CSV to JSON Converter

Convert CSV into JSON, and JSON back into CSV.

CSV to JSON Converter tool

Direction
—

About the CSV to JSON Converter

Spreadsheet exports arrive as CSV, while web apps, APIs and JavaScript code expect JSON. This tool will convert CSV to JSON by turning each row into an object keyed by the header line, so a row of name and city values becomes a neat record ready to use in code, and it converts JSON arrays back to CSV for opening in Excel or Google Sheets. Quoted fields, embedded commas, line breaks inside cells and custom delimiters such as semicolons and tabs are handled correctly, which is where quick hand-written converters usually fail. Numbers can be kept as numbers rather than strings. For larger tables, preview the data first in the CSV Viewer, and to tidy messy files before converting, use the CSV Formatter.

Genuine CSV files are untidier than the format's name suggests, so the parser deals with the difficult cases instead of simply cutting each line at every comma. A value wrapped in double quotes may hold commas, line breaks and quotation marks of its own, and all of it arrives intact in the JSON. For exports from European spreadsheets or from databases, switch the separator to a semicolon or a tab, and say whether the first line holds column names.

If you like, numbers and the words true and false are turned into proper JSON numbers and booleans instead of staying as quoted text, which is usually what code expects to receive. Going the other way, from JSON to CSV, the header row is assembled from every key that appears in any record, and values that need quotes get them, so the file opens cleanly in a spreadsheet.

How to use the CSV to JSON Converter

  1. Pick the directionConvert CSV into JSON, or a JSON array back into CSV.
  2. Paste the dataRows copied from a spreadsheet, or a list of JSON objects from an API or a file.
  3. Adjust the settingsChoose the separator, whether there is a header line and whether numbers and true or false become real types.
  4. Convert and take the resultCopy the output or download it as a .json or .csv file.

CSV to JSON Converter features

  • Conversion in both directions in one place
  • Quoted values with commas, quotation marks and line breaks read correctly
  • Comma, semicolon, tab and pipe separators
  • Header line optional
  • Numbers and true or false can become real JSON types
  • Indented or compact JSON output
  • A summary of how many rows and columns were converted
  • Download as .json or .csv

Common uses

  • Loading a spreadsheet export into an app as starter data
  • Building a test fixture from a list a colleague emailed
  • Opening API results in Excel or Google Sheets
  • Confirming an export is read the way you expect before importing it
  • Moving records between two systems that use different formats

CSV to JSON in practice: spreadsheet exports, leading zeros, dates, Urdu text, nested fields and large files

By the FreeToolsWorld editorial team · Updated November 2026 · How we write and check our guides

Converting spreadsheet exports to JSON is a daily task for developers building imports, dashboards and APIs. The conversion itself is simple, but spreadsheets introduce problems that silently damage data: phone numbers lose their leading zeros, dates become ambiguous and non-Latin text turns into strange characters. This guide works through a customer export, explains each trap and covers nested fields, naming and large files.

A worked example: a customer list

A small export has these lines:

  • name,phone,city
  • Ayesha,03001234567,Lahore
  • Bilal,03211234567,Karachi

Converted to JSON, each row becomes an object with name, phone and city keys. The phone numbers must stay as strings: converted to numbers, they would lose the leading zero and become 3001234567, breaking SMS and calling features. Keeping identifiers such as phone numbers, CNICs and postcodes as text is the most important rule in any conversion.

Leading zeros in spreadsheets

The problem often begins earlier, when the data is opened in a spreadsheet, which may drop leading zeros before the file is even saved. Formatting such columns as text before entering data, or importing the CSV with column types set to text, protects them. Checking a few rows after conversion catches damage before it reaches a database.

Ambiguous dates

A date such as 03/04/2026 means 3 April in Pakistan and the UK but March 4 in the United States. Spreadsheets may reinterpret dates according to the computer's regional settings. Converting dates to ISO format, 2026-04-03, before sharing CSV files removes the ambiguity.

Urdu text and encoding

CSV files containing Urdu or Arabic text should be saved as UTF-8. Some spreadsheet programs open UTF-8 files incorrectly unless they begin with a byte order mark, showing garbled characters. If text looks wrong, re-saving as "CSV UTF-8" in the spreadsheet program, or importing with the encoding specified, usually fixes it.

Numbers with formatting

Exported numbers may include thousands separators, currency symbols or text such as Rs 1,250. These must be cleaned before converting to numeric values, otherwise they remain strings or fail to parse. Deciding which columns are true numbers, such as quantities and prices, and which are identifiers keeps types correct.

Column names as keys

Spreadsheet headers often contain spaces and capitals, such as Order Date, which become awkward JSON keys. Converting them to a consistent style, such as order_date or orderDate, makes the JSON easier to use in code. Duplicate or empty headers should be fixed before conversion.

Nested fields

Flat CSV can represent nested data through column naming, such as address.city and address.postcode. Some converters turn these into nested objects automatically, giving JSON like an address object containing city and postcode. Agreeing on this convention with the system receiving the data avoids confusion.

Large files

Very large CSV files can be slow to convert in one go and produce JSON too big to load comfortably. Converting to JSON Lines, one object per line, or processing the file in chunks, keeps memory use manageable. Command-line and database import tools are better suited to files with millions of rows.

Common mistakes

  • Converting phone numbers and IDs to numbers.
  • Letting spreadsheets reinterpret dates.
  • Saving Urdu text in a non-UTF-8 encoding.
  • Keeping spreadsheet headers with spaces as JSON keys.

Related tools

To explore the result, use JSON Viewer. To go back from JSON to CSV, try JSON to CSV Converter, and to inspect the original file, CSV Viewer.

Empty cells

Decide how empty cells should appear in the JSON: as an empty string, as null or by leaving the key out. Receiving code may treat these differently, and a blank discount cell meaning zero is not the same as a missing value. Choosing one rule and applying it to every column avoids subtle bugs in reports and calculations.

Yes, no and true or false

Spreadsheets record yes-or-no values in many ways, such as Yes and No, TRUE and FALSE, Y and N, or 1 and 0. Converting them all to JSON true and false makes the data much easier to filter in code. Check columns for unexpected values such as maybe or blank before converting.

Lists inside a cell

Some exports pack several values into one cell, such as sizes written as S|M|L. Splitting these into JSON arrays makes them easier to work with. Choose a separator that never appears inside the values themselves, and trim spaces around each item after splitting.

Trimming stray spaces

Trailing spaces turn Lahore and Lahore with a space into two different cities in reports and filters. Trimming spaces from every value during conversion, unless spaces are meaningful, keeps grouping and searching reliable. Invisible characters copied from websites, such as non-breaking spaces, cause the same problem and are worth removing too.

Checking the result

After converting, check that the number of objects equals the number of data rows, and compare the first, a middle and the last record with the original file. If the receiving system has a schema, validating the JSON against it catches missing fields and wrong types before the data is imported.

Privacy

Conversion runs in your browser. Your CSV data is not uploaded or stored.

Further reading: JSON for Beginners: Syntax, Common Errors and Formatting.

Frequently asked questions

What happens to a comma inside a value?

If the value is enclosed in double quotes, its commas, line breaks and quote marks are kept, as the CSV convention allows, and two quote marks in a row are read as one. Cutting lines at every comma is what usually corrupts imports, and this parser avoids it.

What if some rows have more or fewer columns than others?

Missing values become empty strings and surplus values are given automatically generated keys, so no data disappears without warning. The row and column counts shown after conversion make any unevenness easy to spot.

Should numbers be converted to real number types?

When the JSON is headed for code, usually yes, so 42 arrives as a number rather than the text "42". Leave the option off for postcodes, phone numbers, account numbers or product codes, where leading zeros must be kept.

My spreadsheet exported the file with semicolons. Can I still convert it?

Yes. Choose the semicolon separator. Spreadsheets set up for countries that write decimals with a comma use semicolons between columns, which is why an ordinary comma parser turns those files into nonsense.

How are nested objects written when converting JSON to CSV?

Because a CSV cell cannot contain structure, a nested object or array is written into its cell as JSON text. If you need each nested field in its own column, use the JSON to CSV Converter, which flattens them into dotted names.

Is my data uploaded to a server?

No. Reading and converting happen in your browser, so customer lists, sales exports and anything else containing personal details remain on your own device and out of any server logs.