Skip to content

CSV to JSON

Turn spreadsheet rows into JSON, or JSON back into CSV.

0 characters · 0 lines

0 characters · 0 lines

Your files are open only in this tab. Nothing is uploaded.

Related JSON tools: JSON formatter JSON to YAML

How to use CSV to JSON

  1. Choose conversion direction. Keep Direction on CSV -> JSON, or switch to JSON -> CSV for reverse export.
  2. Load your data. Paste spreadsheet text, click Sample, or open a .csv, .tsv, .json, or .txt file.
  3. Configure delimiter and types. Leave Separator on Auto-detect, toggle First row is column names, and adjust Numbers and true/false as values.
  4. Export the result. Copy the formatted output directly or download data.json or data.csv to your device.

Everything runs in this browser tab. Nothing you paste or open is uploaded or logged, so it's safe for keys, tokens and private data.

How does RFC 4180 CSV to JSON parsing work?

The converter reads spreadsheet text in a local Web Worker, strips any leading UTF-8 byte order mark, and tokenizes rows according to the IETF RFC 4180 Common Format and MIME Type for CSV Files. Quoted fields preserve embedded commas, semicolons, and newline characters while collapsing doubled "" quotes into literal quote marks.

Auto-detecting comma, semicolon, tab, and pipe delimiters

When Separator is set to Auto-detect, the detector scans up to 10,000 characters and 10 logical rows across four candidate delimiters: comma (,), semicolon (;), tab (\t), and pipe (|). It counts unquoted occurrences per row and selects the separator with the highest row-to-row consistency, which converts TSV exports (tsv to JSON) and European semicolon spreadsheets cleanly without manual setup.

If your source workbook is still in .xlsx or .xls format, convert it first using the Excel to CSV converter before transforming rows into JSON.

Stripping UTF-8 BOMs and handling quoted line breaks

Excel and Windows reporting tools frequently prepend an invisible U+FEFF UTF-8 BOM before the first column header, which would otherwise corrupt the first JSON property key. Stripping the BOM automatically ensures "id" stays "id" rather than "\ufeffid".

When a spreadsheet contains an unclosed opening quote, unclosedQuoteLine halts parsing and reports the exact line number where the missing closing quote occurs. That pinpoints broken rows immediately without scanning thousands of lines manually.

Empty lines where every cell is whitespace are filtered out automatically so trailing blank rows at the end of a spreadsheet never produce empty JSON objects.

Safe type inference for 64-bit IDs and leading zeros

Turning raw text cells into native JSON primitives makes downstream code cleaner, yet aggressive type casting can silently corrupt identifiers. When Numbers and true/false as values is enabled, the parser applies strict rules before converting "true", "false", "null", integers, and decimals.

Preserving 53-bit safe integers vs warehouse SKU strings

JavaScript numbers follow IEEE-754 double precision and lose exact integer fidelity above 53 bits, as documented in the MDN Number.isSafeInteger() Reference. Any integer outside Number.isSafeInteger stays a quoted JSON string so 64-bit Snowflake IDs and payment references never round their final digits.

Similarly, scientific-notation strings without a decimal point or explicit +/- sign, such as warehouse SKU 12E4, remain strings instead of turning into 120000. Unchecking Numbers and true/false as values keeps every cell as text, preserving leading zeros in ZIP codes and phone numbers.

CSV cell value Type inference ON Type inference OFF Reason
42 42 "42" Safe integer within 53 bits
9007199254740993 "9007199254740993" "9007199254740993" Exceeds 53 bits (Number.MAX_SAFE_INTEGER)
12E4 "12E4" "12E4" No decimal or +/- exponent sign
true / null true / null "true" / "null" JSON boolean and null literals
02139 2139 "02139" Leading zero kept only when OFF

Header-based JSON objects vs 2D row arrays

When First row is column names is checked, each data row becomes a JSON object keyed by the header row, with duplicate column headers disambiguated as _2 and _3. Unchecking it outputs a 2D JSON array of arrays, which is useful when comparing raw tabular CSV vs JSON representations.

After exporting data.json, you can validate and prettify exported JSON payloads or inspect deeply nested keys in a collapsible tree view.

Bidirectional JSON to CSV conversion and nested objects

Switching Direction to JSON → CSV reverses the workflow inside the same workspace, turning an IETF RFC 8259 JSON Data Interchange Standard array back into spreadsheet-ready data.csv with \r\n (CRLF) line endings.

Flattening nested keys into dotted spreadsheet columns

Nested JSON objects flatten recursively into dotted column names such as address.city and address.country, while arrays inside cells serialize as compact JSON strings. Any cell containing the active delimiter, quotes, newlines, or leading/trailing whitespace is automatically wrapped in double quotes with internal quotes doubled.

Unwrapping single-key API arrays and preserving BigInts

REST APIs often wrap lists inside a single-property object such as {"items": [...]}. When a top-level object holds one array property with no sibling scalar keys, the converter unwraps that array into rows automatically and preserves BigInt integers intact; for dedicated reverse workflows, use JSON to CSV.

If the input JSON is an array of arrays rather than an array of objects, the serializer preserves the exact row and column grid without synthesizing header keys. Every scalar value is escaped cleanly for Excel and Google Sheets.

Tip: Disable Numbers and true/false as values before converting postal codes, product SKUs with leading zeros, or version numbers like 1.10 that must remain exact strings.

Handling large spreadsheets and delimiter workflows

Because all CSV and JSON transformations execute inside a background Web Worker, multi-megabyte exports process without locking scroll or typing in your browser tab. Choosing Tab or Pipe (|) under Separator handles log exports and database dumps where commas appear frequently inside unquoted text.

When working with sensitive payroll ledgers, customer exports, or bank statements, running the conversion locally in JavaScript eliminates third-party server retention risks. You can paste raw clipboard data from Excel or Google Sheets directly, or open .csv, .tsv, .json, and .txt files from disk and download clean data.json or data.csv outputs.

When a multi-million-row CSV export exceeds what your spreadsheet editor or downstream importer accepts in a single file, split large CSV files into smaller chunks locally before converting each batch to JSON. Every byte stays on your machine with zero server requests.

Questions

Why are postal codes and 64-bit IDs preserved as strings?

Integers larger than 53 bits exceed Number.MAX_SAFE_INTEGER and lose trailing digits if parsed as JavaScript numbers, so 64-bit IDs stay strings automatically. For five-digit postal codes with leading zeros such as 02139, uncheck Numbers and true/false as values.

How does RFC 4180 parse commas and line breaks within quotes?

Fields wrapped in double quotes can contain literal commas, semicolons, and multi-line breaks without splitting into extra columns or rows. Escaped double quotes written as two consecutive quotes inside a field collapse into one quote.

What happens if CSV columns share identical header names?

To prevent later columns from overwriting earlier values inside JSON objects, duplicate header names automatically receive numeric suffixes such as name_2 and name_3. Blank header cells fall back to column1, column2, and so on.

How are European semicolon-separated spreadsheets converted?

Regional Excel exports often use semicolons instead of commas because commas serve as decimal separators. Leave Separator on Auto-detect to score delimiters across the first ten rows automatically, or pick Semicolon (;) directly.

When should you choose JSON object records over 2D row arrays?

Keep First row is column names checked when feeding REST APIs, NoSQL imports, or typed front-end components that expect named keys. Uncheck it when converting headerless matrices or numeric tables into compact 2D row arrays.

How does in-browser parsing keep financial spreadsheet data private?

All parsing and serialization run inside your browser tab via a local Web Worker without network uploads. Payroll exports, customer lists, and accounting ledgers never leave your device.

Updated