PlayTools

CSV to JSON Converter

Convert CSV to a JSON array of objects or arrays, with delimiter choice, header handling and optional number/boolean type inference. RFC 4180 quoting respected.

Runs in your browser — nothing you enter is uploaded

The parser follows RFC 4180: fields may be wrapped in double quotes, and a doubled quote inside a quoted field is a literal quote, so commas and line breaks inside quotes are kept intact. With a header row, each record becomes an object keyed by column name; without one, each row becomes an array. Type inference is a convenience — disable it to keep every value as a string. Nothing leaves your browser.

Advertisement

Parsing CSV into JSON the right way

CSV looks trivial until a value contains a comma. The format that actually works is described by RFC 4180: any field may be wrapped in double quotes, and inside a quoted field the delimiter and line breaks are literal text, while a doubled quote ("") means one quote character. A naive split on commas breaks on the first quoted address or free-text comment; this parser handles those cases.

With "First row is the header" enabled, the first line supplies the keys and each subsequent line becomes an object — the natural shape for feeding an API or a JavaScript array. Disable it and every row becomes an array of strings instead, which is useful when the data has no headers or you want positional access.

Type inference is a convenience with a sharp edge. Turned on, cells that look numeric become JSON numbers, "true"/"false" become booleans and "null" becomes null. That is handy for analytics data but wrong for ZIP codes, phone numbers, order IDs and anything with significant leading zeros — "01730" would become 1730. When in doubt, leave inference off and keep everything as strings.

Choose the delimiter to match your source: comma, semicolon (common in European exports), tab, or pipe. Rows with fewer fields than the header get empty strings for the missing columns; rows with extra fields have the surplus ignored. A run of mismatched column counts usually points to an unescaped quote somewhere upstream.

Parsing happens entirely in your browser. Nothing is uploaded, and the converter works with the network disconnected. Very large files (tens of thousands of rows) are held in memory, so a streaming parser is better for those.

Key formulas (reference)

scan character by character, tracking an "in quotes" flag:
  "  → toggle quotes  (or, if the next char is ", emit one " and skip)
  delimiter (outside quotes) → end field
  newline  (outside quotes) → end field and row
header mode: row[i] → { header[0]: cell0, header[1]: cell1, … }

These free tools pair well with this page — open them in a new tab to finish your workflow.

Advertisement

Frequently Asked Questions

Does it handle quoted fields with commas inside?

Yes. The parser follows RFC 4180: fields wrapped in double quotes may contain the delimiter, line breaks and doubled quotes ("") which represent a literal quote character. So "Doe, Jane" is read as a single field.

What does "First row is the header" do?

When enabled, the first row supplies the object keys and every following row becomes an object. When disabled, each row becomes a plain array of values and no keys are assigned.

What is type inference?

With "Infer numbers & booleans" on, cells that look like numbers become JSON numbers, "true"/"false" become booleans, and "null" becomes null. Turn it off to keep every value as a string, which is safer for things like ZIP codes, phone numbers and IDs with leading zeros.

Which delimiters are supported?

Comma, semicolon, tab and pipe. Pick the one your source file uses. Files exported from European locales often use semicolons; database and spreadsheet exports often use tabs.

How are rows with too few or too many fields treated?

With a header row, missing trailing fields become empty strings and extra fields beyond the header are ignored. Inconsistent column counts usually indicate an unescaped quote or delimiter somewhere in the source.

Is there a row limit?

There is no hard limit, but very large inputs (tens of thousands of rows) are parsed in the browser and held in memory, so extremely large files may be slow. For those, a streaming parser or a command-line tool is more appropriate.

Is my data uploaded?

No. Parsing runs entirely in your browser and nothing is sent anywhere. You can use the converter with the network disconnected.