Skip to content
Toolcroft

CSV to JSON Converter

Developer Tools

Convert CSV files or pasted data to JSON or JSONL in your browser with delimiter detection, headers, type inference, and quoted fields. Nothing is uploaded.

Numbers, booleans, and null are inferred; leading zeros stay as text.

Paste CSV or drop a local .csv, .tsv, or .txt file. Files are read in this browser.

How to use this tool

  1. Paste or open a CSV file. Enter CSV data in the left input area, or choose Open file to read a local .csv, .tsv, or .txt file in your browser.
  2. Choose options. Select the delimiter (or use Auto-detect), toggle header row, and enable or disable type inference.
  3. Choose an output and save it. The JSON array or JSON Lines output updates as you type. Use Copy or Download to save the result, and choose pretty, tab-indented, or minified JSON array formatting.

What is CSV?

CSV (Comma-Separated Values) is a plain-text format for tabular data. Each line is a row and values within a row are separated by a delimiter, typically a comma, semicolon, or tab. CSV is one of the most common data interchange formats used by spreadsheets, databases, and data pipelines.

Why convert CSV to JSON?

JSON is the native data format for JavaScript and most modern web APIs. Converting CSV to JSON lets you feed data from spreadsheets directly into web applications, REST APIs, or JavaScript code. JSON also supports typed values (numbers, booleans, null) that CSV cannot express natively.

How does type inference work?

When type inference is enabled, the converter automatically promotes cell values to their most appropriate JSON type. It parses safe numbers, booleans, and null values, while digit strings with leading zeros and integers outside JavaScript's safe range stay as strings. That keeps ZIP codes such as 00721 and long account identifiers from changing during conversion.

  • Safe numeric strings like "42" or "3.14" become JSON numbers.
  • "true" and "false" (any case) become JSON booleans.
  • Empty strings and the literal text "null" become JSON null.
  • Leading-zero identifiers and integers outside JavaScript's safe range stay strings.
  • Other unrecognized values stay strings.

Open and save local files

You can paste CSV into the input, choose a local .csv, .tsv, or .txt file, or drop a file onto the input area. The browser reads the selected file locally; the contents are not sent to a server. Use Download to save the converted result with a matching .json or .jsonl extension. Files larger than 10 MB may make live conversion slower because the text is parsed in the current tab.

Handling special characters

Fields that contain the delimiter character, line breaks, or double-quote characters must be wrapped in double quotes. Two consecutive quotes ("") inside a quoted field represent a single literal double-quote. The PapaParse library handles all of these cases automatically.

Flat vs. nested JSON

With the header option enabled, this tool outputs flat JSON: an array of objects where each object represents one row, and each key is a column header. Example:

[
  { "name": "Alice", "age": 30 },
  { "name": "Bob", "age": 25 }
]

Nested JSON groups data by relationships, e.g., all rows with the same ID under one parent object. CSV is inherently flat; generating nested structures requires a follow-up transformation (e.g., using Array.reduce() in JavaScript or a tool like jq).

JSON Lines (JSONL)

JSONL (also called newline-delimited JSON) is a variant where each line is one JSON value with no wrapping array. With headers enabled, each line is an object:

{"name":"Alice","age":30}
{"name":"Bob","age":25}

JSONL is common in data pipelines (BigQuery, Elasticsearch bulk API, Apache Spark) because it's streaming-friendly - you can process one record at a time without loading the entire file into memory. Choose JSON Lines (JSONL) under Output format to emit each CSV record on its own line. If the header toggle is off, each line is an array value instead of an object.

Frequently asked questions

What delimiters are supported?

The tool supports comma (,), semicolon (;), tab (\t), and pipe (|) delimiters. Select "Auto-detect" to let the parser figure it out from your data.

What is type inference?

When enabled, safe numeric values become JSON numbers, "true"/"false" become booleans, and empty strings or "null" become JSON null. Digit strings with leading zeros and integers outside JavaScript’s safe range stay strings so ZIP codes and large IDs are preserved. Disable it to keep all values as strings.

How are quoted fields handled?

Fields wrapped in double-quotes can contain commas or line breaks without being split. Two consecutive quotes inside a quoted field (\"\") represent a single literal quote.

Is my data sent to any server?

No. Pasted CSV and files you open are read and converted locally in your browser using the open-source PapaParse library. Your data never leaves your device.

What happens if my CSV has no header row?

Disable "Has header row" and the result will be a JSON array of arrays instead of an array of objects.

Can I convert a CSV file to JSON Lines?

Yes. Choose JSON Lines (JSONL) under Output format. Each CSV record becomes one compact JSON value on its own line, without an enclosing array.

What happens when column names repeat?

Repeated or blank headers are made unique in order. For example, two "name" columns become "name" and "name_2", and blank columns receive names such as "col3".

Browse all developer tools