T

Text Machine

Powerful text tools, in your browser

CSV to JSON Converter

Convert CSV or TSV into clean JSON in your browser. The first row becomes the keys, the delimiter is detected automatically, and you can keep each value as text or have numbers and booleans typed — nothing is uploaded.

Delimiter

Output

Values

The first row becomes the keys for each object.

CSV
JSON

Your JSON will appear here.

How to use CSV to JSON Converter

  1. 1

    Paste your CSV

    Paste rows of CSV or TSV data with one record per line. Keep the column names in the first row so they can become the keys.

  2. 2

    Pick the delimiter

    Leave it on Auto to detect commas, semicolons, or tabs automatically, or choose the delimiter your data uses.

  3. 3

    Choose the output shape

    Use Objects to turn each row into an object keyed by the header, or Rows to keep every line as a simple array. Switch Values to Typed to read numbers and booleans as real JSON types.

  4. 4

    Copy the JSON

    Copy the formatted JSON and paste it straight into your code, an API request, or a config file.

Parsing CSV into JSON: Headers, Types, and the Irregularities

CSV looks simple and is not

A comma-separated file appears trivial — values, commas, newlines — but that simplicity is a trap. CSV has no official, universally enforced standard; RFC 4180 documents the common conventions, yet exporters disagree on quoting, line endings, and delimiters. The hard cases are exactly the ones a naive split on commas gets wrong: values that themselves contain commas, values that contain the quote character, and values that span multiple lines.

A real parser handles those by reading the quoting rules rather than just splitting text. A field wrapped in double quotes may legally contain commas and escaped quotes (written as two double quotes in a row), and this tool honors exactly that: a cell holding "Portland, Oregon" stays one value instead of becoming two columns, and a doubled quote inside a field collapses to a single literal quote. The one case it does not reconstruct is a value with a line break inside the quotes, because it first splits the file into records line by line — so keep each record on its own line, or strip in-cell newlines, before converting.

The output shape: an array of objects

The natural JSON form of a table is an array of objects, one object per data row. The first row of the CSV is treated as the header, and each header cell becomes a key shared by every object. Paste three columns named name, role, and city followed by two data rows, and you get an array of two objects, each with those three keys mapped to that row's values. This is the shape most APIs and import scripts expect.

If your data has no header row, that mapping has nothing to draw keys from. Switch to the rows output mode and each line becomes a plain array of values instead, preserving the raw grid without inventing names. Choosing the right output mode up front saves you from objects keyed by the accidental first data row.

Everything is a string until you say otherwise

This is the single most important caveat when reading CSV. The format carries no type information at all — every cell is text. Without intervention the number 42 becomes the string 42, the word true becomes the string true, and an empty cell becomes an empty string. Code that expects a real number or boolean from those fields will quietly misbehave.

Enable typed values and the parser promotes plain numeric text to JSON numbers, the words true and false to booleans, and the word null to a real null. Type inference is convenient but inherently heuristic, so watch the edges: identifiers with leading zeros, phone numbers, ZIP codes, and version-like strings are technically numeric-looking but should usually stay text. When exactness matters for those fields, keep values as text and convert deliberately in your own code.

Delimiter detection and TSV

Not every separated-values file uses commas. Spreadsheets in many European locales export with semicolons because the comma is the decimal mark, and copying a range straight out of a spreadsheet usually yields tab-separated values. Auto mode inspects the first line of your input and picks whichever of comma, semicolon, or tab appears most often there, so a comma file, a semicolon file, and a TSV all convert without you changing a setting.

Auto-detection is reliable for clean data but can be fooled by a file whose first line happens to contain more of one separator than the real delimiter. If the columns come out wrong, override the guess and set the delimiter explicitly — that removes the ambiguity in one step.

Encoding, BOMs, and other invisible gremlins

Files exported from spreadsheet software frequently begin with a byte-order mark, an invisible character at the very start of the file. Left in place, it gets glued onto the first header name, so a key that should be id silently becomes a slightly different string and your lookups by id miss. Inconsistent line endings between operating systems and trailing blank lines are the other usual suspects that produce phantom rows or off-by-one columns.

This tool trims every header and cell, so the usual gremlins mostly take care of themselves: it tolerates both Unix and Windows line endings, and because a leading byte-order mark counts as trimmable whitespace, it is stripped from the first header automatically instead of being glued onto the key. That is why pasting a raw spreadsheet export here usually just works. If a converted key still refuses to match in code, suspect a stray character that trimming does not remove — a zero-width space, say — and re-export the file as plain UTF-8.

Ragged rows and empty cells

Real spreadsheets are messy: some rows have trailing empty cells, some are missing fields entirely, and a stray blank line sneaks in at the end. When a row has fewer values than there are headers, the missing fields show up as empty strings rather than crashing the conversion, so the output array stays rectangular and every object carries the full set of keys.

Before trusting the result, skim it for a tell-tale row where the values seem shifted one column over — that is the signature of an unescaped delimiter inside an unquoted field upstream. Fixing the source file (quote the offending value) is far more reliable than trying to patch the JSON afterward.

Where CSV-to-JSON earns its keep

The most common use is turning a spreadsheet someone hands you into data your program can consume: seed a database, build the body of an API request, generate a config file, or feed a test fixture. Non-developers live in spreadsheets, developers live in JSON, and this conversion is the bridge between the two without writing a throwaway parser each time.

Because the entire parse runs in your browser, you can convert sensitive exports — customer lists, internal metrics, financial rows — without uploading anything to a third-party service. Keep one rule in mind for downstream safety: decide consciously whether each column should be typed or left as text, since silent type coercion is the most common reason imported data behaves differently from what the spreadsheet showed.

Frequently asked questions

How do I convert CSV to JSON?
Paste your CSV with the column names in the first row, and the formatted JSON appears instantly below. Use the Copy button to grab the result. Everything runs in your browser.
Does the first row have to be a header?
In Objects mode the first row is used as the keys for every object. If your data has no header, switch to Rows mode and each line becomes a plain array of values instead.
Can it read tabs or semicolons, not just commas?
Yes. Auto mode detects commas, semicolons, and tab-separated data, so a spreadsheet copy or a European-style CSV both convert without changing any settings.
How are numbers and booleans handled?
By default every value stays a string. Switch Values to Typed and the tool reads plain numbers as JSON numbers, true and false as booleans, and the word null as a real null.
Is my data uploaded anywhere?
No. The conversion happens entirely in your browser with JavaScript, so your CSV never leaves your device and nothing is stored on a server.

Related tools

Keep going with these handy tools

JSON to CSV Converter

Unix Timestamp Converter

JSON to YAML Converter

Text to Binary Converter

Text to Hex Converter

Morse Code Translator