Skip to content
Plaintools

CSV to JSON converter

Paste CSV text with a header row to generate formatted JSON objects. Handles RFC 4180 quotes, commas, and line breaks in the browser, with options to auto-detect numbers and booleans or minify output. No data is sent to a server.

In-browser parser · Never uploaded

Need the reverse? Use the JSON to CSV converter, or inspect configs with the YAML to JSON converter.

CSV to JSON converter example

Convert three CSV user rows to JSON

Header name,role,remote followed by Ada Lovelace,Mathematician,true yields a JSON array of objects with typed booleans and string fields.

CSV to JSON converter how-to

  1. Parse CSV according to RFC 4180: track state inside/outside double quotes, handle escaped quotes `""` as a literal quote, handle commas as field delimiters, and CRLF / LF as row breaks.
  2. Trim records, dropping empty trailing lines. Require at least two rows (one header row and at least one data row).
  3. Extract headers from the first row. Normalize duplicate headers by suffixing `_2`, `_3`, etc., and replace empty headers with `column_N`.
  4. Map each subsequent data row to an object keyed by header columns. Extra fields beyond column count become `_extra_1`, etc. Missing fields default to empty string.
  5. If parseTypes is enabled: parse "true"/"false" to booleans, "null" to null, and unquoted numeric strings to numbers (excluding strings with leading zeroes).
  6. Serialize to JSON: `JSON.stringify(records, null, 2)` (or compact if minify is requested) with a trailing newline.

Related tools

Dev

Hash generator

Calculate SHA-256, SHA-384, SHA-512, and SHA-1 checksums for text or local files.

People also use

Dev

JWT decoder

Read a JWT header and payload, with human timestamps and an expired flag. The token stays in the tab.

Dev

Text diff checker

Compare two texts with a live line and word diff. Optional ignore-whitespace.

Dev

Timestamp converter

Convert Unix epoch timestamps in seconds or milliseconds to ISO 8601, UTC, and local time.

Dev

Subnet calculator

Calculate IPv4 network address, broadcast, usable range, subnet mask, and host capacity from CIDR.

CSV to JSON converter FAQ

What is a CSV to JSON converter?
A CSV to JSON converter turns CSV rows into a JSON array of objects keyed by the header row. Each data row becomes one object and each column header becomes a key. This one runs in your browser. Nothing is uploaded.
Is my CSV uploaded to a server?
No. The CSV is parsed directly in this tab using client-side JavaScript. No data is sent over the network or logged anywhere.
Does the CSV require a header row?
Yes. The first line of the CSV must contain column headers, which become the keys of each JSON object in the resulting array.
How does this tool handle commas and newlines inside quotes?
It follows standard RFC 4180 rules. Fields enclosed in double quotes can contain commas, line breaks, and escaped double quotes ("").
What does auto-detect numbers and booleans do?
When enabled, unquoted text matching numbers (e.g. 42 or 3.14) or booleans (true, false, null) are parsed into JSON numbers and booleans rather than strings. Strings with leading zeroes (like zip codes or phone numbers) remain strings.
Can I convert JSON back to CSV?
Yes. Use our paired JSON to CSV converter to turn an array of JSON objects back into an RFC 4180 CSV spreadsheet.
How do I convert CSV to JSON without this page?
Tokenize CSV according to RFC 4180: track quote state, treat doubled quotes as literal quotes, split on unquoted commas for fields and unquoted newlines for rows. The first row defines the keys. Map each subsequent row into an object where obj[headers[i]] = row[i]. If type coercion is enabled, parse numeric and boolean literals. Format with JSON.stringify(results, null, 2).