# CSV to JSON

> Convert CSV or cells pasted from Excel to JSON: real numbers and true/false, nested objects from dotted columns, JSON Lines and 5 layouts. Free, private.

Canonical: https://cromagnon.app/tools/csv-to-json
Last updated: 2026-10-26

- Category: Convert
- Formats: CSV · TSV → JSON · JSONL
- Use it: https://cromagnon.app/tools/csv-to-json (free, runs in the browser)

## What it does

Turn a CSV file, or cells copied from Excel or Google Sheets, into JSON that an app, an API or a database can use straight away. The converter finds the separator for you (comma, semicolon, tab or pipe), reads files saved in any common encoding, turns numbers and true/false into real JSON values while keeping codes such as 02134 as text, builds nested objects from column names like address.city, and gives you five layouts: a list of objects, a list of rows, an object keyed by the first column, an object of columns, or JSON Lines. Everything happens in your browser, so even a 100 MB export is converted without being uploaded.

## How to use it

1. Click Open CSV file, drop a file on the box, or paste cells from a spreadsheet. Click Sample to see how it works first.
2. Check the row and column count and the separator the tool found; choose another separator if it guessed wrong.
3. Pick a layout. A list of objects is what most code expects; JSON Lines is best for very large files and data warehouses.
4. Choose how numbers, empty cells and dotted column names are treated, and how far to indent.
5. Copy the JSON, or download it as a .json or .jsonl file named after your CSV.

Tip: If the JSON will be loaded back into a spreadsheet later, untick “Numbers and true/false as values”. Every cell then stays text exactly as it was, so phone numbers, ZIP codes and long IDs can never be changed by a program that treats them as numbers.

## The five JSON layouts and when to use each

- **List of objects**: [{"id": 1, "name": "Ali"}, …]. Each row is an object named by the header row. This is what REST APIs, JavaScript code, MongoDB imports and most no-code tools expect, so start here.
- **List of rows**: [["id", "name"], [1, "Ali"], …]. The header is the first row and every row is a plain list. It is the smallest file and keeps the column order, which suits charts and table libraries.
- **Object by first column**: {"1": {"name": "Ali"}, …}. The first column becomes the key, so code can look up a row by its ID without searching. The IDs must be unique: a repeated ID keeps the last row.
- **Object of columns**: {"id": [1, 2], "name": ["Ali", "Sara"]}. One list per column, the way charting tools and data-science libraries such as pandas like to receive data.
- **JSON Lines (.jsonl)**: One object per line with no surrounding list. Files can be read line by line, so it is the format for big exports, logs, BigQuery, Elasticsearch bulk loads and training data for AI models.

## How values are converted

With “Numbers and true/false as values” ticked, 12 becomes the number 12, 3.5 becomes 3.5, and true, TRUE or false become JSON true and false. Values that only look like numbers are left as text on purpose: anything with a leading zero (02134, 007), numbers too long to be stored exactly (credit-card-length IDs and 16-digit order numbers), and values with spaces or currency symbols. That way nothing is silently rounded or stripped.

Empty cells can become null, an empty string, or be left out of the object entirely. Leaving them out gives smaller JSON and suits databases where a missing field means “unknown”; null is clearer when every record must have the same fields.

Column names with dots are turned into nested objects when “Nest dotted columns” is ticked: address.street and address.city become {"address": {"street": …, "city": …}}. Untick it to keep the dotted names as flat keys.

## Fixing common CSV problems

- **Everything is in one column**: The file uses a separator the tool didn't expect. European Excel saves with semicolons; choose Semicolon in Separator.
- **Strange characters like Ã© or ?**: The file was saved in an older encoding. The converter detects Windows-1252, UTF-16 and UTF-8 with or without a BOM, and shows which one it used next to the file name.
- **Empty or repeated column names**: JSON keys must be unique, so a blank header becomes Column 3 and a second Name becomes Name_2. A note tells you how many were renamed, so no data is lost.
- **Commas inside a value**: Values like "12 Main St, Apt 4" must be in double quotes in the CSV. Files exported from Excel, Sheets and databases already do this, and line breaks inside quotes are kept too.
- **Extra spaces**: “Trim spaces” removes spaces at the start and end of every cell, which often sneak in when data is typed by hand.

## Converting cells straight from a spreadsheet

You don't need to save a CSV first. Select the cells in Excel, Google Sheets or Numbers, including the header row, copy them, and paste them into the box. Copied cells are separated by tabs, which the tool detects automatically. This is the fastest way to turn a small table into test data or a settings file.

## Tips

- **Check the first object**: Read the first record in the preview before downloading. If a field is wrong there, it is wrong in every row.
- **Minify for APIs**: Choose Minified in Indent to send JSON over a network: the file is often 20–30% smaller.
- **Big files**: For files over a few hundred MB, use JSON Lines: programs can stream it one record at a time instead of loading it all.
- **Keep IDs as text**: If an ID column has numbers, untick value conversion or the IDs become numbers that some systems reformat.

## Questions

### How do I convert CSV to JSON?

Open or paste the CSV, choose a layout such as List of objects, and click Download. The header row gives the JSON keys and each following row becomes one object.

### Can it make nested JSON?

Yes. Name columns with dots, such as customer.name and customer.email, and tick Nest dotted columns to get a customer object inside each record.

### Why is my ZIP code still in quotes?

Values with a leading zero stay text so 02134 doesn't become 2134. Other numbers become real JSON numbers.

### What is the largest file it can convert?

Up to 100 MB. The box shows the start of a large file, but the download contains every row.

### Does it work with semicolon or tab-separated files?

Yes. The separator is detected automatically, and you can choose comma, semicolon, tab or pipe yourself.

### Is my file uploaded?

No. The file is read and converted in your browser, on your device; nothing is sent to a server or stored, so customer lists, payroll and other private data stay private.

## Related

- [JSON to CSV](https://cromagnon.app/tools/json-to-csv)
- [Excel to CSV](https://cromagnon.app/tools/excel-to-csv)
- [CSV Cleaner](https://cromagnon.app/tools/csv-cleaner)
- [JSON Formatter](https://cromagnon.app/tools/json-formatter)
- [All tools](https://cromagnon.app/tools)
