CSV to JSON Converter
Convert CSV and Excel to JSON or JSON Lines, and JSON back to CSV or .xlsx. Every sheet of a workbook, nested objects from a.b headers, columns you pick and rename, an editable table, and files of 100 MB and more streamed in your browser. Nothing is uploaded.
Enterprise Data Extraction Engine
Layerbit's CSV pipeline utilizes a custom lexical parser to guarantee data integrity. Unlike standard regex-based converters, it accurately maps complex fields containing internal commas and line breaks wrapped in quotes.
NoSQL Database Migrations
Easily transition relational spreadsheet data (like Excel or Google Sheets exports) into structured document arrays ready for direct import into MongoDB, Firebase, or DynamoDB collections.
E-Commerce Bulk Uploads
Transform large CSV vendor catalogs into nested JSON payloads to programmatically update Shopify, WooCommerce, or custom e-commerce backend APIs via bulk REST operations.
Data Science & Machine Learning
Pre-process raw CSV datasets into clean JSON objects for easier integration with Python scripts, frontend charting libraries like Chart.js, or client-side analytical dashboards.
UAE Invoice Compliance
Already have your invoices as a CSV export? Run the same file through our UAE PINT-AE E-Invoice Readiness Checker to check it against the 51 mandatory PINT AE fields and export PINT AE XML to review with your Accredited Service Provider, for free.
Quick Testing Templates
Click any of the sample CSV configurations below to instantly load them into the pipeline and verify the converter's logic.
Frequently Asked Questions
By default, CSV files treat all data as text strings. When "Smart Types" is enabled, Layerbit's engine automatically detects numerical values (like 42 or 3.14) and boolean values (like true or false) and formats them as native integers, floats, and booleans in the resulting JSON output, rather than wrapping them in quotation marks. It never changes a value to do so: anything with a leading zero (00123), a + sign (+971…), more than 15 significant digits, or a spelling a number would not keep (1.10) stays text. Below the input, each column shows the type it was given, and you can set any column to text, number or true/false.
Standard CSV rules dictate that any text containing a comma (like an address: "Dubai, UAE") must be wrapped in double quotes. Our custom lexical parser specifically reads these encapsulation markers, ensuring that internal commas are treated as normal text characters rather than accidental column delimiters.
Absolutely not. The Layerbit CSV pipeline operates within an air-gapped browser environment. The file reading, parsing logic, and JSON generation are executed entirely client-side using JavaScript. No data is ever transmitted to a backend server or database.
Excel, LibreOffice and Google Sheets treat a cell that begins with =, +, - or @ as a formula, so a value such as =HYPERLINK("http://…") in your data can run when someone opens the file (CSV or formula injection). With Safe for Excel on, which is the default, such values are written with a leading apostrophe ('=HYPERLINK(…)); spreadsheets show them as text. Plain numbers such as -5 or +3.5 are left alone. Turn it off when the CSV feeds another program that must receive the exact text.
Yes. Drop or upload an .xlsx, .xlsm, .xls or .ods file and every sheet is listed with its row count. Pick one sheet to see it as CSV (where you can edit it, choose columns and set types), or pick All sheets to get one JSON object with a key per sheet; with JSON Lines output, each record carries a _sheet field instead. Cells are read as Excel shows them: dates as formatted, formulas as their last calculated value. The workbook is read by the open-source SheetJS library inside your browser.
JSON Lines (also called NDJSON) puts one JSON object on each line instead of wrapping everything in one array. Log pipelines, BigQuery, Elasticsearch bulk loads and most streaming tools read it, because a program can process one line at a time without loading the whole file. Choose JSON Lines as the output format; in JSON → CSV mode, JSON Lines input is recognised automatically, and a broken line is reported by its line number.
Name the columns by path and switch on Nest a.b headers: customer.name and customer.city become {"customer": {"name": …, "city": …}}, and items.0.sku, items.1.sku become an array. If one column holds a value where another needs an object (a and a.b), that column is kept flat and listed above the input, rather than one silently overwriting the other. Going the other way, Flatten nested turns nested JSON into exactly these column names, so the two directions round-trip.
Yes, in both directions. Under the input, each column has a box to include it, a name you can change (press Enter), arrows to move it, and in CSV → JSON a type. The choices stay while you edit the data or load a file with the same columns, and new columns are added at the end.
Yes. Below the converter, the table preview shows every row (only the rows on screen are drawn, so 100,000 rows scroll smoothly). Double-click a cell, or select it and press Enter, type, and press Enter; the change goes back into the CSV or JSON input and the output updates. Escape cancels. In JSON → CSV mode a number stays a number when you type a number.
Files of 20 MB and more are not loaded into the text box. A background worker reads them in slices and writes the result straight into the file you save, while the page shows progress and the first 100 records. In our tests a 150 MB CSV with 2 million rows became 349 MB of JSON in about 17 seconds, and a 122 MB JSON Lines file became CSV in 16 seconds, without uploading anything. The limit is your device's memory for the finished file. A single JSON array (not JSON Lines) is read whole inside the worker, so for very large JSON prefer JSON Lines.
Yes. Switch to "JSON → CSV" mode and paste a JSON array of objects, or JSON Lines (one object per line; the format is detected). The header row is built from the union of every key across all objects, so records with slightly different fields (an optional notes column on some rows, for example) still produce one clean table instead of dropping data. With Flatten nested on (the default), nested objects and arrays become columns named by their path, such as user.name and tags.0; switch it off to write each nested value as JSON in one cell. Save .xlsx writes an Excel workbook instead of CSV.
Why a real parser matters more than you would expect
CSV looks like it can be handled with two string splits, and that assumption is behind a remarkable number of data-corruption bugs. RFC 4180 permits a field to contain commas, double quotes and even line breaks, provided the field is wrapped in quotes with internal quotes doubled. A perfectly legal single record can therefore look like this:
7,"O'Brien, Jr.","He said ""no"" twice","Dubai\nUAE"
Four fields — one containing a comma, one containing escaped quotes, one containing a real newline mid-record. Splitting on commas yields six fragments; splitting the file on newlines yields three "rows". Both are wrong, and both are what naive code produces. This converter uses a proper lexical state machine, so quoted delimiters are treated as data rather than structure. Our CSV guide covers the wider format problems in depth.
Smart type inference
CSV has no type system — every value is text. With Smart Types enabled, numeric and boolean-looking values become real JSON numbers and booleans instead of quoted strings, but only when that changes nothing: postcodes with a leading zero, phone numbers with a + and identifiers longer than 15 digits stay strings automatically, and the per-column type list lets you force any column to text, number or true/false. Turn Smart Types off to keep every value a string.
Union-of-keys on the way back
Converting JSON to CSV, the header row is built from every key seen across all records. Objects with differing shapes — an optional notes field on some rows — produce one complete table rather than silently dropping the columns that only appear later.
Nulls and empties
CSV cannot distinguish an empty string from a null, a missing field or a deliberate blank — there is one representation for all four. If that distinction matters in your domain, agree a sentinel value with the other side or use a format with real types.
The spreadsheet at the other end
A correct CSV file can still be corrupted the moment somebody opens it, because spreadsheet applications run type inference on every cell. None of these are hypothetical:
01234becomes1234— a leading zero has no numeric meaning, so postcodes and account numbers lose digits.- A 16-digit number becomes
4.01289E+15once it exceeds 15 significant digits. 1-5and3/4become dates. So, famously, did the gene symbols SEPT2 and MARCH1 — corrupted so routinely in published genomics data that the naming committee renamed the genes in 2020.- In locales where the decimal mark is a comma, Excel expects a semicolon delimiter and opens a comma file as a single column.
This happens on open, not on export: your file is correct until the tool reading it changes it and someone saves. If humans will open the data in a spreadsheet, an .xlsx export avoids the whole category: in JSON → CSV mode, Save .xlsx writes text cells as text (so 00123 keeps its zero) and numbers as numbers.
Formula injection in exports
One security note that catches people out, because the vulnerability is in your output rather than your input. If a cell begins with =, +, - or @, spreadsheets treat it as a formula. An attacker who can store text in your database — a display name, a ticket subject — can plant a payload that executes when an administrator later exports and opens the file. Before writing any user-supplied value, prefix such values with an apostrophe. Quoting the field is not sufficient, because the quotes are consumed by the CSV parser before the spreadsheet sees the value.
Changelog
- v3.0.0 Excel in and out: every sheet of an .xlsx, .xls or .ods workbook is listed, one sheet or all of them convert, and JSON converts to an .xlsx whose text stays text, numbers stay numbers and nothing becomes a formula. JSON Lines as output, and as input recognised automatically. Nested JSON from a.b headers (objects and arrays) and flattening back. Columns can be included, renamed and reordered in both directions. An editable table preview whose edits go back into the input. Files of 20 MB and more stream through a background worker with progress and a preview, tested with a 150 MB, 2-million-row CSV.
- v2.2.0 One shared CSV reader for every tool: a quote inside a field (5" screen) is a literal character instead of swallowing the rest of the file, the delimiter is detected without counting the ones inside quotes, repeated header names become separate keys (amount, amount (2)), a one-column file keeps rows whose value is empty, and rows with the wrong number of values are listed with their line. Smart Types never change a value (leading zeros, + signs and numbers over 15 digits stay text), an empty cell stays an empty string instead of becoming null, and each column's type can be set to text, number or true/false; long numbers forced to number keep every digit. JSON to CSV keeps long numbers exact and has a Safe for Excel switch, on by default, that writes formula-like values with a leading apostrophe.
- v2.1.0 Delimiter handling: automatic detection picks the separator that is most consistent across the first lines (comma, semicolon, tab or pipe), which is what European-locale exports from Excel need, and a manual override is a click away. A file that yields one column is now refused with a hint instead of producing a single mangled field.
- v1.5.0 Added a JSON → CSV reverse mode, building the header row from the union of keys across all objects so heterogeneous records don't lose columns.
- v1.4.0 Added direct-to-disk download capability for generating
.jsonfiles natively in the browser. - v1.3.5 Rewrote the CSV parsing engine to correctly handle multi-line strings and escaped quotes.
- v1.1.0 Introduced the Smart Type Inference toggle for cleaner payload generation.