Convert CSV to JSON

Paste CSV or drop a file and get a JSON array back, made on this device.

Converts CSV to JSON: each row becomes an object, the first row supplies the keys, and you copy the array or download it as a .json file. It is free, needs no account and adds no watermark, and your data is not uploaded: what you paste and the files you drop are converted by code in this tab. Every value stays text unless you tick Detect types, so an id such as 00123 keeps its zeros.

Drop a CSV file to turn into JSONor click to choose a file.
    Working…

    Done

    Your files are processed on this device and never sent to a server. Reload the page to clear everything from memory.

    Worked example. You export a short list from a spreadsheet as CSV and need it as JSON for a script or an API test. This is the file:

    id,name,qty,active 00123,Ada Lovelace,3,true 00124,"Hopper, Grace",12,false

    Paste it, leave the options as they are and press Convert to JSON. The first row becomes the keys, and the quoted comma in "Hopper, Grace" stays inside the value:

    [ { "id": "00123", "name": "Ada Lovelace", "qty": "3", "active": "true" }, { "id": "00124", "name": "Hopper, Grace", "qty": "12", "active": "false" } ]

    Every value is text, written exactly as it was in the CSV. Tick Detect types and qty becomes the number 3, active becomes true, and id stays "00123", because a value with leading zeros is kept as text. A header such as user.name is written as the flat key "user.name"; the page does not rebuild nested objects.

    Untick First row is headers and you get an array of arrays instead, one per row. If a row has more or fewer values than the widest row, the shorter ones are filled with empty text and the result says how many rows that was.

    How it works

    1. Paste CSV into the box, or drop a .csv file. The page works out that it is CSV and picks CSV to JSON.
    2. Check the delimiter, whether the first row is headers, and whether to detect types.
    3. Press Convert to JSON, look at the preview, then copy the JSON or download the .json file.

    In your browser, not on a server

    A small parser written for this page, with no library, reads your text in a background worker in this tab. JSON is read with the browser’s own JSON parser, and one object per line is accepted too. CSV is read by a parser that follows RFC 4180: quoted values, a doubled quote for a quote, and line breaks inside quotes; the delimiter is detected from the first lines unless you choose one. The result is written in the tab, with quoting added only where a value needs it and, if you leave it ticked, a UTF-8 byte-order mark at the start so Excel reads the letters correctly.

    Compared with upload-based tools: Online converters make you paste or upload the data to their server, and customer lists and exports are often exactly the data you should not hand over. Here what you paste and any file you drop is converted on your device and never sent anywhere, and the limit is your device’s memory (phones hold less).

    Verify it yourself. Give the page a short while after one visit to save itself for offline use, then turn off Wi-Fi or switch to airplane mode and run the tool again. Or open your browser's developer tools (F12, or Cmd-Option-I on a Mac), pick the Network tab, and watch it while you convert. The panel above does the same count for you.

    Questions

    How do I convert CSV to JSON?

    Paste your CSV into the box or drop the file, and press Convert to JSON. The first row becomes the keys and each row after it becomes an object in one array. Copy the result, or download it as a .json file. The page shows the first 40 lines so you can check it before you use it.

    Why are my numbers and true/false values in quotes?

    By default every value stays text, exactly as it is in the CSV, so an id such as 00123 is not changed. Tick Detect types to turn plain numbers, true, false and null into real JSON values. Values with leading zeros, and numbers of 16 digits or more, stay text even then, so long ids are not rounded.

    My CSV uses semicolons or tabs. Will it work?

    Yes. The delimiter is detected from the first lines of your data, and you can set it yourself to comma, semicolon, tab or pipe. Excel in many countries saves a CSV with semicolons, and this page reads that as it is.

    What if my CSV has no header row, or the rows are different lengths?

    Untick First row is headers and each row becomes an array of values. Rows that have fewer or more values than the widest row are padded with empty text so every object has the same keys, and the page tells you how many rows needed it. A header that is empty is named column_1, column_2 and so on, and a repeated header gets _2, _3.

    Can I convert a CSV to JSON without uploading it?

    Yes. The text you paste, or the file you drop, is parsed and written out by code running in this tab, in the background so the page stays usable. After one visit and a short wait the page works offline. A file can be up to 200 MB; a phone may run out of memory on a smaller one, and the page says so instead of giving a half result.

    More PDF tools

    Other conversions