CSV conversion

CSV to JSON: preserve text and fix ambiguous rows

A CSV cell does not declare whether its contents are an identifier, number or date. Our converter keeps every value as a JSON string and rejects ambiguous structure instead of silently repairing it. Use it to prepare small, disposable fixtures from spreadsheet exports, not to validate real-world records.

Why values stay text

00123 may be a code, not the number 123. The literal text true or null may also be intentional. Empty cells become an empty string, not a missing key or null. Leading and trailing spaces remain unchanged. If Excel already removed leading zeros before export, this converter cannot recover them.

Long identifiers such as 9007199254740993 must not pass through JavaScript numeric conversion. Keeping them as strings avoids numeric rounding here. Convert types later only when you know the receiving API contract. JSON to TypeScript can suggest types, but it does not validate the data.

Choose the separator and quote whole fields

Choose comma, semicolon or Tab explicitly; we do not guess. The first record is always the header. An incorrect separator may produce a single column without a syntax error, so check the reported column count. Only UTF-8 files up to 1 MiB are supported; re-export Big5 or Excel workbooks as UTF-8 CSV first.

A field containing a separator or newline must be enclosed in double quotes. Within that quoted field, write a literal quote twice: "". LF and CRLF line endings are accepted and preserved inside quoted values. Lone CR is rejected. Only a BOM at the beginning is removed. RFC 4180 describes a common format, not every CSV dialect; semicolon and Tab are explicit extensions used by this tool.

Fix the source instead of accepting a repair

Every header must have a nonblank, unique name. Duplicates are rejected, not renamed or merged into arrays. Spaces in names are preserved, with a warning for surrounding spaces. A/b and __proto__ are literal keys, not instructions to build nested objects.

Each data record must have exactly the header's field count. A trailing separator creates an empty final cell; a missing separator can mean a missing column. Blank lines are not skipped: they form a one-field empty record and therefore fail in a multi-column file. A final line terminator does not add a record. A header-only file returns [].

Errors report physical text line and column positions (columns count UTF-16 code units), plus the pending data record when parsing data. Quoted newlines increase the line number but do not start a new data record. Header errors happen before data record 1. No partial JSON is offered after an error; fix the source and convert again.

Copy the full result within local limits

Processing runs in a browser Worker, with a 5-second timeout. Limits are 10,000 records, 200 columns, 200,000 data cells and 8 MiB of output. Repeated long headers can make JSON much larger than CSV; split the input or shorten headers if output exceeds the limit. Device performance still varies.

The result previews up to 100 records. Copy and download always use the full result, including records not shown. If clipboard permission is denied, download converted.json or select the visible text (only the preview). Editing, clearing or changing the separator invalidates old output. No input or result is uploaded, stored or placed in a URL. Downloading creates a local file at your request; refreshing the page discards the in-page data.

JSON strings can still contain untrusted content. This conversion does not prove identity, factual accuracy, safe HTML, or safe execution by a downstream system. Use approved organizational tools for sensitive customer records.

When original line endings matter

Pasted text may have CRLF normalized to LF by the browser's text area. Choose the original UTF-8 file when preserving embedded line endings matters.

code,note
00123,"Comma, quote "" and
new line"

Data provenance

Sources