UtilityNest

CSV to JSON

Turn a CSV table into JSON you can use in code, APIs or config files. Choose whether the header row becomes keys, whether numbers and true/false are detected, and the exact shape and formatting of the output.

Header names become keys.

Leading zeros (04524) and numbers over 15 digits stay strings.

address.city becomes {"address": {"city": ...}}.

How to use CSV to JSON

  1. 1Paste CSV into the box, or open or drop a .csv, .tsv or .txt file.
  2. 2Choose the output shape: an array of objects (keys from the header row) or an array of arrays.
  3. 3Set the options: header row, number and true/false detection, empty cells as "" or null, nested keys and empty rows.
  4. 4Pick pretty (2 or 4 spaces) or minified output.
  5. 5Click Copy or Download to save the .json file.

Options that match how the JSON will be used

  • First row is the header: header names become the keys. Empty names become column_1, column_2, and duplicates get _2, _3 so no value is lost.
  • Detect numbers and true/false: 42 and 3.14 become numbers, true and false become booleans and null becomes null. Values with a leading zero (ZIP codes, phone numbers) and numbers over 15 digits stay strings, because converting them would change the data.
  • Empty cells can become empty strings or null, whichever your code expects.
  • Nest "a.b" headers: a column called address.city becomes {"address": {"city": ...}}, which reverses what JSON to CSV does.
  • Array of arrays keeps the table as rows of values, useful for charts and compact payloads.

Any CSV, any encoding

The delimiter is detected automatically (comma, semicolon, tab or pipe), and quoted fields with commas or line breaks inside them are parsed correctly. Files are decoded with automatic encoding detection, including UTF-8 with or without BOM, UTF-16, Korean CP949 from Excel and Japanese Shift_JIS, and you can override it. Big files are converted in a background thread, so the page keeps responding while a file with hundreds of thousands of rows is processed. The text box shows the beginning of very large results, while Copy and Download always include everything.

For a spreadsheet instead of JSON, use CSV to Excel. To validate or reformat existing JSON, use the JSON Formatter.

How much bigger the JSON gets (tested)

We converted a 447 KB CSV with 10,000 rows and 6 columns (id, name, city, price, in_stock, updated):

OutputSizevs. CSV
Array of objects, pretty (2 spaces)1.43 MB3.2 x
Array of objects, minified1.01 MB2.3 x
Array of arrays, minified527 KB1.2 x

Objects repeat every key name on every row, which is where most of the growth comes from. For files that ship to a browser or an API with a payload limit, minify, and consider Array of arrays with the header as the first row. Keep pretty output for files people read and diff.

What the types come out as

With number and true/false detection on, the first record of that file came out as {"id":1,"name":"Item 1","city":"Busan","price":285.03,"in_stock":true,"updated":"2026-05-11"}. Note what did and did not change:

id and price became numbers, and true and false became booleans. Dates stay strings, because JSON has no date type, so code that needs dates must parse "2026-05-11" itself; the YYYY-MM-DD form sorts correctly as text, which is a good reason to keep it. Values like 04524 and numbers longer than 15 digits also stay strings, so nothing is altered.

If a column holds codes that look numeric but are not quantities (product codes such as 1001, 1002), detection will turn them into numbers. When the consuming code expects strings, turn detection off and convert the few real numeric columns in your code instead.

Frequently asked questions

Why are some numbers kept as strings?

Values like 04524 or 010-1234-5678 would lose their meaning as numbers, and numbers longer than 15 digits cannot be stored exactly in JSON parsers. Keeping them as strings preserves the data.

Can I convert a CSV without a header row?

Yes. Turn off First row is the header. Keys become column_1, column_2 and so on, or choose Array of arrays to get plain rows.

Does it handle commas and line breaks inside values?

Yes. Quoted fields are parsed according to the CSV standard, including doubled quotes ("") inside a value.

Is my data sent to a server?

No. Parsing and conversion happen in your browser, and the CSV never leaves your device.

Can I get minified JSON?

Yes. Choose Minified for a single line with no extra spaces, or pretty output with 2 or 4 spaces of indentation.

Why is my JSON three times bigger than the CSV?

An array of objects repeats every column name on every row, and pretty printing adds spaces and line breaks. In our test a 447 KB CSV became 1.43 MB pretty and 1.01 MB minified; Array of arrays brought it down to 527 KB.

Are dates converted to a date type?

No. JSON has no date type, so dates stay as strings exactly as written in the CSV. Parse them in the code that reads the JSON.

How do I keep numeric-looking codes as strings?

Turn off number and true/false detection. Every value then stays a string, and you can convert the genuinely numeric columns in your own code.

My CSV has a comma inside a value. Will the columns shift?

Not if the value is in double quotes, as RFC 4180 describes and as Excel writes it: "Seoul, Korea" stays one value. A comma inside an unquoted value does split it into two columns, so fix the source or switch the delimiter if the file actually uses semicolons or tabs.

Related guides