Free tool

CSV to JSON with Encoding, Separator and Number Controls

A spreadsheet export has to feed a script, an import or an API, and they all want JSON. Drop the CSV file, or paste the text, and the JSON appears live, with four output shapes and the care it needs for codes and accents.

JSON

The JSON shows here as soon as there is CSV to read.

The file is read and converted inside your own browser, and nothing is uploaded or saved. Only the options you picked, such as the output shape, are remembered on this device.

From a spreadsheet export to something a script can read

Drop a CSV file into the box, click to choose one, or paste the text. A short sample with names, cities, ages, zip codes and dates is waiting there so you can see the idea first. The JSON panel updates as soon as there is something to read. Then press Copy, or Download .json.

The first row is read as column names by default. If your file has no header row, untick that box and each record becomes a plain list of values.

Choosing the shape of the output

ShapeLooks likeGood for
A list of objectsOne object per row, with the headers as keysMost scripts and import tools
JSON Lines, one object per lineEach row is its own line of JSONLarge files and streaming
One object, keyed by the first columnThe first column's values become the keysLookup tables such as codes to names
A list of arraysRows as plain lists, no keysCompact data with the header kept apart

Indent can be 2 spaces, 4 spaces, tabs or none, where the JSON is minified.

Separators, accents and odd encodings

CSV files from different programs do not agree on how to separate values. Split on is set to Find it for me, which checks commas, semicolons, tabs and pipes with a real CSV reader, and you can pick one yourself if it guesses wrong. A field wrapped in double quotes may hold a comma or a line break without splitting, so a value like a city and state stays in one place. RFC 4180, from October 2005, describes that quoting rule.

Text encoding is also found for you. If accents look wrong, such as strange symbols in a name, choose the encoding by hand. The list includes UTF-8, Windows-1252, ISO-8859-1, UTF-16 LE, Windows-1250, Windows-1251, Mac OS Roman, Shift JIS and GBK.

Types, codes and decimal commas

Turn numbers and true/false into real values is on by default, so 34 becomes a number instead of a quoted string, and an empty cell becomes null. Two safeguards matter for site data.

  • A value that starts with a zero, like a zip code 02134, or a plus sign, stays text.
  • Whole numbers with more than 15 digits are not converted, since a JavaScript number cannot hold them exactly.
  • Numbers are written like can be Find it from the separator, a decimal point such as 1,234.5, or a decimal comma such as 1.234,5.

Tick Dotted headers as nested objects to rebuild structure, so a column called address.city becomes a city inside an address object. If every value must stay text, untick the typing box.

A quick way to check a conversion is to look at the first two records in the JSON panel and compare them with the first two rows of your sheet. Look at dates in particular. They are kept as text, so a column of dates arrives as strings, which most import tools accept and then parse on their own.

If you see every value in quotes, the typing box is off. If a column of ids shows as numbers with lost digits, check that it has fewer than sixteen digits.

Product lists and catalogue feeds

Shop owners meet this task when a product sheet has to become the format a store or a feed reads. Check zip codes, SKUs and barcodes after converting, since those are the values that suffer most from number typing. Our ecommerce development page explains how product data is planned for a build.

Frequently asked questions

How do I convert a CSV file to JSON?

Drop the file in or paste the text. The JSON appears live, and you can copy it or download a .json file.

Why are my accented letters broken?

The file is probably in a different encoding. Pick the right one from the Text encoding list, such as Windows-1252 for older Excel files.

Will leading zeros be lost?

No. A value that starts with a zero stays as text, so a zip code like 02134 is kept.

What is JSON Lines?

It is a file where each line is one complete JSON object, which is useful for large data.

Can it handle semicolons or tabs?

Yes. It detects commas, semicolons, tabs and pipes, and you can also choose the separator yourself.

Is my file uploaded?

No. It is read and converted in your browser.

More free tools

  • JSON to CSV converter: Turn JSON into CSV or Excel with nested fields as columns, and CSV back into JSON.
  • JSON formatter: Format, minify, validate and repair JSON, browse it as a tree, or convert it to YAML or CSV.
  • YAML formatter: Check and tidy YAML, keep comments, and view it as JSON, a tree or compact flow style.
  • Diff checker: Compare two texts or files side by side, merge changes and export a diff.
  • Base64 decoder and encoder: Decode Base64 to text or a file and encode text or files to Base64 and data URLs.