Skip to content

CSV to JSON

Turn CSV text or a file into JSON as objects, arrays or JSON Lines, with codes like 007 and long IDs kept as strings.

Paste CSV text or choose a file to see the JSON.

The file is read in your browser and never uploaded.

[{ "id": 1 }, …] — the usual shape

What it does

A CSV file holds only text, while JSON has types, so a converter has to decide what each value is. Most of them guess badly: a product code of 007 becomes the number 7, an 18-digit order id becomes 123456789012345680 because it no longer fits in a number, and a price written as 1.50 comes back as 1.5. The file still says 007; the JSON does not.

This converter uses a simple rule instead: a value becomes a number only when the number prints back as exactly the same text. So 12 and -2.5 become numbers, while 007, +1, 1.50 and long id numbers stay strings, keeping the value you actually had. true and false become booleans, and an empty cell becomes null, which is what most programs expect. You can turn either of those off if your program wants everything as text.

Comma, semicolon and tab files are detected automatically, quoted fields containing commas or line breaks are handled properly, and you can pick the shape of the output: an array of objects with the header row as keys, an array of arrays, or JSON Lines with one record per line for logs and bulk imports. Everything runs in your browser: choosing a file reads it on your device, and nothing is uploaded or stored.

How to use it

  1. Paste your CSV into the box, or choose a .csv file from your device.
  2. Pick the output shape: an array of objects is the usual choice for an API or a script.
  3. Turn off First row is the header if your file has no header row, and turn off the type options if you want every value as a string.
  4. Press Copy JSON, or download the file. The line under the output says how many records were read.

Frequently asked questions

Why do other converters turn 007 into 7?

Because they call the language's standard number conversion on every value that looks numeric, and a number has no way to remember a leading zero. The same thing shortens long id numbers, which lose their last digits once they are too big for a double. This tool converts a value only when the result prints back identically, so those values keep their exact text.

What do empty cells become?

null by default, which is how most programs represent a missing value. Turn off Empty cells as null and they become empty strings instead, which is better when your code expects every field to be text. Rows shorter than the header still get every key, so no record is missing a field.

What is JSON Lines and when should I use it?

JSON Lines writes one record per line with no surrounding array, so a program can read a huge file one line at a time rather than loading it all at once. Log pipelines, database bulk imports and streaming APIs usually want this format, often with the .jsonl or .ndjson extension.

Are duplicate or empty column names a problem?

No. Every column gets a key: an empty header becomes column1, column2 and so on by position, and a repeated name gets a suffix, so the second id column becomes id_2. Without that, a repeated name would silently overwrite the earlier value.

Can I go the other way, from JSON to a spreadsheet?

Yes, with JSON to Excel & CSV, which flattens nested objects into columns. The two tools use the same rule about which values are numbers, so a table can go out to JSON and back without anything changing.

Is my file uploaded anywhere?

No. The CSV is parsed and the JSON is built inside your browser. Nothing is sent to a server, nothing is stored, and there is no account. After the page loads you can work offline.