Skip to main content
CT

CSV to JSON Converter

Paste CSV data with a header row and get a clean JSON array of objects — proper quoted-field parsing, not a naive comma split.

Did you like the tool? Thanks!
Share:


    

How to Use CSV to JSON Converter

Paste CSV text, including a header row, and the tool parses it into a JSON array with one object per data row, using the header values as keys. Quoted fields containing commas, quotes, or line breaks are parsed correctly rather than being split apart incorrectly. Click Download to save the result as a .json file, or copy it directly.

About CSV to JSON Converter

Converting CSV to JSON sounds like it should be as simple as splitting each line on commas, but that approach breaks the moment a field itself contains a comma — for example, an address ("123 Main St, Apt 4"), a formatted number ("1,234.56"), or a free-text description. The CSV format handles this with quoting: a field containing a comma, a double quote, or a line break is wrapped in double quotes, and any literal double quote inside that field is escaped by doubling it (`""`). A parser that just calls `.split(',')` on each line has no awareness of quoting at all, so it will cut a quoted field into multiple pieces wherever a comma happens to appear inside it, silently shifting every subsequent column out of alignment for that row. This tool implements a proper character-by-character CSV parser instead: it tracks whether it is currently inside a quoted field, treats commas and line breaks inside quotes as literal characters rather than delimiters, and unescapes doubled quotes back into a single quote in the parsed value. This means a field like `"Smith, John"` parses as the single value `Smith, John`, and a field spanning multiple lines inside quotes is correctly kept as one multi-line value rather than being split into separate rows. The first row of your input is always treated as the header row, and its values become the object keys for every subsequent row — so a CSV with columns `name,age,city` produces objects shaped like `{"name": ..., "age": ..., "city": ...}`. Blank lines in the input are skipped rather than turned into empty objects. On typing: this tool does not attempt full type inference. By default every field becomes a JSON string, which is the only choice that is always correct — CSV itself has no type system, so "is this a number or a string that happens to look like a number" is genuinely ambiguous without extra context (a postcode of "02139" or a phone number of "0207946..." would be silently corrupted by naive numeric coercion, since JSON numbers cannot have leading zeros and lose formatting). The one exception this tool makes is for values that are trivially and unambiguously numeric — see the details section for the exact rule — since spreadsheets and APIs both commonly expect actual numeric fields like quantities or prices to come through as JSON numbers rather than quoted strings.

Details & Tips

The "trivially numeric" coercion rule, precisely: a field's trimmed value is converted to a JSON number only if it matches the pattern of a plain integer or decimal — optional leading minus sign, digits, optional decimal point and more digits — and does not have a leading zero (unless the value is exactly "0" or starts with "0."). This deliberately excludes values like "02139" (a US zip code) or "007" (which would otherwise become the misleading number 7), while still converting values like "30", "-12.5", or "0.75" to real numbers. Every other field, including anything with letters, symbols, or a leading-zero integer, stays a JSON string. This behaviour is a deliberate compromise, not full type inference — if you need guaranteed-string output for every field with no exceptions, quote the value in your CSV source and this tool leaves quoted-and-non-numeric-looking content as a string, which it already does by default. Empty fields (two consecutive commas, or a trailing comma before a line break) become an empty string `""` in the output, not `null` and not an omitted key — every row's object always has exactly the same set of keys as the header row, in the same order, which keeps the output predictable for downstream code that expects a fixed shape. Parsing details: quoted fields are recognised by a field starting with a double quote; everything up to the next unescaped double quote is taken literally, including commas and line breaks; `""` inside a quoted field becomes a single literal `"` in the output. Unquoted fields are simply the text between commas, trimmed of a leading/trailing carriage return but not otherwise trimmed of whitespace (so " London" with a leading space is preserved exactly, in case that space is meaningful in your data). Only the comma is treated as a field delimiter — semicolon-delimited or tab-delimited files are not auto-detected and should be converted to commas first, or handled with a different tool. The Download button saves the parsed result as a formatted (indented) `.json` file via a Blob and a temporary download link; the Copy button copies the same JSON text to your clipboard. If the header row contains duplicate column names, the later column silently overwrites the earlier one in each resulting object, since a JSON object cannot hold two values under the same key — rename duplicate columns in your CSV source if you need to keep both.

Frequently Asked Questions

Does this tool handle commas inside quoted CSV fields correctly?
Yes. It uses a proper character-by-character parser that tracks quoted fields, rather than a naive split on every comma — so a value like "Smith, John" stays as one field instead of being cut in two.
Does it infer number and boolean types from the CSV?
Mostly no — every field becomes a JSON string by default, which is the only always-correct choice since CSV has no type system. The one exception is values that are trivially numeric (plain integers or decimals without a leading zero), which convert to JSON numbers.
Why does a zip code like 02139 stay a string instead of becoming a number?
The numeric-coercion rule explicitly excludes values with a leading zero (other than "0" or "0.xxx") to avoid corrupting zip codes, phone numbers, and similar identifiers that look numeric but should not lose their formatting.
What happens to blank cells in the CSV?
They become an empty string in the resulting JSON object, not null and not a missing key — every row keeps the same set of keys as the header row.
Can a field span multiple lines?
Yes, if it is wrapped in double quotes in the source CSV. The parser treats line breaks inside quotes as part of the field value rather than as a row separator.
What is the first row of my CSV used for?
It is always treated as the header row, and its values become the property names (keys) for every object in the resulting JSON array.
What if two header columns have the same name?
The later column overwrites the earlier one in each row's object, since JSON object keys must be unique. Rename duplicate columns in your source CSV if you need to preserve both.
Does it support semicolon- or tab-delimited files?
No, only comma-delimited CSV is supported. Convert semicolon- or tab-delimited data to commas first if needed.
Are blank lines in my CSV turned into empty objects?
No, blank lines are skipped entirely rather than producing empty entries in the output array.
Is my data uploaded anywhere?
No. Parsing happens entirely in your browser using JavaScript — nothing you paste is sent to a server.
How is the output formatted?
As an indented (pretty-printed) JSON array, which you can copy directly or download as a .json file.

Part of These Collections

Also Available As

csv to json, csv to json converter, convert csv to json, csv parser, csv to json array

Found a Problem?

Let us know if something with CSV to JSON Converter isn't working as expected.

Thanks — we'll take a look.