AnyTool
Your files never leave your device. All processing happens locally in your browser.

How do I convert a CSV file to JSON in the browser without uploading it?

Open the CSV to JSON Converter, then paste your CSV, drop in a .csv / .tsv / .txt or Excel (.xlsx / .xls) file, or fetch a CORS-enabled URL — and it converts to JSON live as you type, entirely in your browser. The first row is read as the field names (headers), and each following row becomes a JSON object, producing the classic array of objects like [{“name”:“Alice”,“age”:28}]. The delimiter is auto-detected (comma, tab, semicolon or pipe), and the parser follows RFC 4180, so quoted fields, embedded commas, escaped double-quotes (“”), newlines inside a cell and a leading BOM are all handled. Type inference is conservative and round-trip safe: “true” / “false” become booleans, “null” becomes null, and clean numbers become numbers — but a value like 007 or a phone number stays a string so it isn’t mangled. Beyond the default array of objects you can output array of arrays, columns (keyed arrays), an object keyed by a field, or NDJSON (one JSON object per line), as pretty-printed or minified JSON, and dot-notation headers like address.city can be nested into sub-objects. A live table preview shows the first 100 rows, and you can flip the whole tool around to go JSON → CSV. Export the result as .json, .jsonl, .csv or a real .xlsx workbook, or copy it to the clipboard. Everything runs on your device — the file is never uploaded to any server, so private or sensitive data stays on your machine (files up to 50 MB).

  • First row becomes JSON keys; each row becomes an object — the classic array of objects, live as you type
  • RFC 4180 parsing (quoted fields, embedded commas & newlines, escaped “” quotes, BOM) with auto delimiter detection (comma / tab / semicolon / pipe)
  • Round-trip-safe type inference: booleans, null and clean numbers convert, while 007, IDs and phone numbers stay strings
  • 5 output shapes (array of objects, array of arrays, columns, keyed, NDJSON), pretty or minified, plus dot-path nesting
  • Reverse JSON → CSV, .xlsx import / export, and export to .json / .jsonl / .csv / .xlsx — 100% client-side, up to 50 MB

What is

CSV to JSON Converter

A CSV to JSON converter transforms comma-separated-values data — a plain-text table where each line is a record and fields are separated by a delimiter — into JSON, the structured format used by APIs, config files and JavaScript. The standard conversion treats the first CSV row as the field names and turns every following row into a JSON object with those keys, giving an array of objects; other useful shapes include an array of arrays (raw tabular data), column arrays keyed by header, an object keyed by one field’s value, and NDJSON (newline-delimited JSON, one object per line, common for streaming and log pipelines). Real-world CSV is trickier than it looks: the de-facto standard is RFC 4180, which defines how a field containing the delimiter, a double-quote or a line break is wrapped in double-quotes with an internal quote written as two quotes (“”), while European exports often use a semicolon and some files carry a UTF-8 byte-order mark (BOM), so a robust converter auto-detects the delimiter and parses to the RFC 4180 rules rather than naively splitting on commas. Type inference decides whether “28” should stay a string or become the number 28; a careful converter only coerces values that round-trip exactly, so leading-zero codes (007), long IDs and phone numbers are preserved as strings. This converter is 100% client-side: it parses, coerces and serialises in your browser with no upload, reads and writes Excel via a bundled xlsx engine, runs the conversion in reverse (JSON → CSV, flattening nested objects), and can nest dot-notation headers such as address.city into sub-objects. Its honest limits: it maps a flat table to records, very large files are bounded by browser memory (a 50 MB cap), and fetching a remote URL only works when that server sends permissive CORS headers.

File Tools

Related terms

CSVJSONRFC 4180delimiterNDJSONJSON Linesarray of objectstype inferenceTSVExcelxlsxBOMUTF-8JSON to CSVCSV to Excel

Frequently Asked Questions

No. The CSV is parsed and converted entirely in your browser — there is no upload, server or account, so your data never leaves your device.

Nothing is uploaded. When you paste text or open a file the converter reads it locally with the browser’s File API, parses it into an in-memory table, and does the type inference and JSON serialisation on your device in JavaScript. There is no server, API, database or tracking in the processing path, so a spreadsheet of customers, finances or any other sensitive data stays on your machine. The tool works offline once cached, and closing the tab discards everything. The one case where data touches the network is if you paste a remote URL for the tool to fetch — and even then the response is downloaded straight into your browser and never sent anywhere else. The only optional network use anywhere on the site is consent-gated advertising, which never sees your file.

It only converts values that round-trip exactly, so “true” / “false” and “null” and clean numbers convert, while 007, long IDs and phone numbers stay strings.

Type inference is conservative on purpose, because turning a ZIP code or an order number into a number silently corrupts data. With inference on, “true” and “false” (any case) become booleans, “null” becomes null, and a value becomes a number only when it round-trips exactly — that is, converting the string to a number and back yields the identical string. That rule protects leading zeros (007 stays “007”), long identifiers that would lose precision, phone numbers, and anything with formatting, so they all remain strings. Everything else stays a string too. You can turn inference off entirely to keep every value as a string, which is the safest choice when the data is really all identifiers or codes.

Yes. Besides the default array of objects it can emit array of arrays, column arrays, an object keyed by a field, or NDJSON, and it can nest dot-path headers like address.city.

The converter offers five output shapes. Array of objects is the classic [{…},{…}] where each row is a record. Array of arrays keeps the raw tabular grid. Columns produces one keyed array per column, which suits columnar analysis. Keyed builds a single object indexed by the values of a field you choose (handy for lookups by id). NDJSON emits one JSON object per line, the format streaming and log pipelines expect, and it downloads as .jsonl. On top of the shape, you can pretty-print with 2-space indentation or minify, and enable dot-path nesting so a header like address.city produces {“address”:{“city”:…}} instead of a flat key. The live table preview and stats update as you switch shapes.

Yes. It runs in reverse (JSON → CSV, flattening nested objects), imports .xlsx / .xls, and can export the result as CSV or a real .xlsx workbook as well as JSON / NDJSON.

The tool is bidirectional. Switch to JSON → CSV and it takes an array of objects (or arrays), flattens any nested objects into dot-notation columns, builds a header from the union of all keys, and escapes every field to RFC 4180 so commas, quotes and newlines inside values survive. It also handles Excel both ways: uploading an .xlsx or .xls workbook reads the first sheet into the grid, and you can export your converted data as a genuine .xlsx workbook with a bold header row and auto-sized columns, alongside plain .json, .jsonl (NDJSON) and .csv downloads, or copy the output to the clipboard. A Swap button turns the current output into the next input so you can round-trip in one click.

Detailed Explanation

How It Works

Converting CSV to JSON in Your Browser

The CSV to JSON Converter turns tabular data into structured JSON without ever uploading it. Paste CSV, drop in a .csv, .tsv or .txt file, an Excel workbook (.xlsx / .xls), or a CORS-enabled URL, and it converts live as you type. The standard mapping treats the first row as the field names and turns each following row into a JSON object, producing the classic array of objects — [{“name”:“Alice”,“age”:28}]. The delimiter is auto-detected (comma, tab, semicolon or pipe) and parsing follows RFC 4180, so quoted fields, embedded commas, escaped double-quotes and newlines inside a cell survive, and a leading UTF-8 BOM is stripped. Conservative, round-trip-safe type inference turns “true” / “false” into booleans, “null” into null and clean numbers into numbers, while leaving 007, long IDs and phone numbers as strings so they aren’t corrupted. A live table preview shows the first 100 rows and a stats line reports row, column and byte counts. Everything — parsing, coercion and serialisation — runs locally in JavaScript, so sensitive data never leaves your machine.

  • First row becomes JSON keys; each row becomes an object (array of objects), live as you type
  • Auto delimiter detection (comma / tab / semicolon / pipe) and RFC 4180 parsing with BOM handling
  • Round-trip-safe type inference keeps 007, IDs and phone numbers as strings
  • 100% client-side — nothing is uploaded to any server
Use Cases

Shapes for APIs, Pipelines and Config

Different jobs need different JSON shapes, so the converter offers five. Array of objects is what most REST APIs and JavaScript code expect and is the default. Array of arrays keeps the raw tabular grid for lightweight transport. Columns emits one keyed array per column, which suits columnar analysis and plotting. Keyed builds a single object indexed by the values of a field you pick — ideal for building an id-to-record lookup. NDJSON (newline-delimited JSON) writes one object per line and downloads as .jsonl, the format data-warehouse loaders, log pipelines and streaming tools ingest line by line. On top of the shape you can pretty-print with 2-space indentation for readability or minify for the smallest payload, and switch on dot-path nesting so a header like address.city produces a nested {“address”:{“city”:…}} object instead of a flat key. Because the tool is bidirectional, you can also go the other way — JSON → CSV — to flatten an API response into a spreadsheet, and the Swap button feeds the current output back in as the next input for quick round-trips.

  • Five shapes: array of objects, array of arrays, columns, keyed-by-field, and NDJSON (.jsonl)
  • Pretty (2-space) or minified output; dot-path headers like address.city nest into sub-objects
  • NDJSON suits streaming, logs and warehouse loaders that read one object per line
  • Bidirectional: JSON → CSV flattens nested objects; Swap round-trips output back to input
Technical Details

RFC 4180 Parsing, Delimiter Detection and Conservative Coercion

A hand-written state-machine parser reads the CSV to the RFC 4180 rules. It tracks quote state so a double-quoted field can contain the delimiter, real line breaks and literal double-quotes written as two quotes in a row (“”); it strips a leading UTF-8 byte-order mark; and it handles both CRLF and LF endings. The delimiter is auto-detected by sampling the first ~4 KB and counting commas, tabs, semicolons and pipes that fall outside quotes on the first line, which correctly handles European semicolon exports and tab-separated files. Type coercion is deliberately strict: “null” maps to null and “true” / “false” to booleans, but a token becomes a number only when it matches a canonical numeric pattern AND String(Number(s)) === s — an exact round-trip — so 007, 1e3-looking artifacts, long IDs and phone numbers stay strings rather than silently changing value. Shape building then maps rows to the chosen structure, and dot-path nesting walks each header segment to build sub-objects. The reverse path flattens nested objects into dot-notation columns, takes the union of all keys as the header, and re-quotes any field containing the delimiter, a quote or a newline. Conversion is debounced and runs on every keystroke, with the whole file (up to 50 MB) held and processed in memory.

  • Quote-aware RFC 4180 state machine: embedded commas / quotes / newlines and BOM handled; CRLF and LF supported
  • Delimiter auto-detected by scoring a ~4 KB sample outside quotes (comma / tab / semicolon / pipe)
  • Numbers coerced only on an exact String(Number(s)) === s round-trip, protecting 007, IDs and phone numbers
  • Reverse JSON → CSV flattens nested objects to dot-notation columns and re-quotes to RFC 4180
Limitations

Honest Limitations

The converter maps a flat table to records, so it is honest about what it does not do. Type inference is intentionally conservative — it will not turn a leading-zero code, a long ID or a phone number into a number, which is the safe default but means you occasionally want inference off to keep everything as strings. Nesting is limited to dot-path headers you opt into; the tool does not infer arbitrary nested arrays or objects from column naming beyond the address.city style, and going JSON → CSV flattens nested structures into dot-notation columns and serialises arrays or leftover objects as JSON strings, so a deep document is squared into a grid rather than preserved perfectly. Excel handling reads the first worksheet as plain values, so multiple tabs, formulas, cell formatting and charts are not carried through. Everything is held in browser memory, so size is bounded: the tool accepts inputs up to 50 MB, and very large or very wide files use more RAM and can slow a low-memory device, where a database or command-line tool is a better fit. Loading from a remote URL only works when that server sends permissive CORS headers, and the fetch fails with a clear message otherwise rather than silently.

  • Conservative inference won’t coerce 007, IDs or phone numbers — turn it off to keep all values as strings
  • Nesting is limited to opt-in dot-path headers; JSON → CSV flattens and stringifies deep structures
  • Excel import reads the first sheet as plain values — no formulas, multiple tabs, styling or charts
  • Bounded by browser memory (50 MB cap); remote-URL loading needs permissive CORS or it fails clearly
Privacy & Security

Privacy: Your Data Stays on Your Device

CSV and JSON files often hold exactly the data you should not upload — customer lists, financials, API dumps, health or HR records — and this converter is built so they never leave your machine. Input is read with the browser’s File API, parsed into an in-memory table, coerced and serialised locally in JavaScript, and the JSON, NDJSON, CSV or .xlsx result is generated on your device, with no server, upload, database, logging, API or CDN anywhere in the processing path. The tool works offline once cached, and closing the tab discards everything. The only moment anything touches the network is if you explicitly paste a remote URL for the tool to fetch, and even then the response is downloaded straight into your browser and sent nowhere else. The only optional network use anywhere on the site is consent-gated advertising, which never sees your file or its contents.

  • Read, parsed, coerced and serialised entirely in the browser
  • No server, upload, database, API or CDN in the processing path
  • Works offline once cached; closing the tab discards everything
  • Only optional network use is consent-gated ads, which never see your file
CSV to JSON Converter — shapes, formats and limits
CapabilitySupportNotes
Input formats.csv, .tsv, .txt, .xlsx, .xlsAlso pasted text, JSON / NDJSON (reverse mode) or a CORS-enabled remote URL; first worksheet read from Excel
DelimitersComma, tab, semicolon, pipeAuto-detected by scoring a ~4 KB sample outside quotes; handles European semicolon exports and TSV
Parsing standardRFC 4180Quoted fields, embedded commas / newlines, escaped “” quotes and a UTF-8 BOM handled
Output shapesArray of objects, array of arrays, columns, keyed, NDJSONPretty or minified; dot-path headers like address.city can nest into sub-objects
Type inferenceBooleans, null, clean numbersRound-trip-safe — 007, long IDs and phone numbers stay strings; can be turned off entirely
Export & scale.json / .jsonl / .csv / .xlsx, up to 50 MBReverse JSON → CSV, copy to clipboard, live 100-row table preview; 100% client-side with no upload

The converter parses to the RFC 4180 standard with automatic delimiter detection (comma / tab / semicolon / pipe), infers types on an exact round-trip so identifiers are preserved, and offers five JSON shapes plus dot-path nesting. It reads and writes Excel (.xlsx / .xls), runs in reverse (JSON → CSV), and is bounded by a 50 MB browser-memory cap; remote-URL loading needs permissive CORS. Everything runs in the browser; nothing is uploaded.