This free CSV to JSON and SQL converter turns a spreadsheet export into clean JSON, a JSON API response back into CSV, and any table of rows into ready-to-run SQL INSERT statements. It detects the delimiter and the header row on its own, shows you exactly what it parsed, and runs entirely in your browser.
Use this CSV to JSON and SQL converter whenever data has to cross a boundary: a Google Sheets export that an API wants as JSON, a JSON dump a colleague wants in Excel, or rows you need in a database without writing an import script.
What This CSV to JSON and SQL Converter Does
The CSV to JSON and SQL converter reads your input into a table, previews the rows with a detected type for every column, and writes the output format you pick.
- Automatic detection: tells CSV from JSON, picks the delimiter (comma, semicolon, tab or pipe) and decides whether the first row is a header. Every guess can be overridden.
- Proper CSV parsing: quoted fields, doubled quotes, line breaks inside quotes, a UTF-8 BOM, and any line endings.
- Sensible types: numbers and booleans are detected per column, so a zip-code column with
01100in it stays text and keeps its leading zero. Integers too long for JavaScript to hold exactly stay text too. - Flexible JSON input: arrays of objects, arrays of arrays, a single object, API responses like
{"data": [...]}, and JSON Lines. Nested objects are flattened into columns such asaddress.city. - Three outputs: JSON (array of objects, array of arrays or JSON Lines), CSV (any delimiter, optional quoting of every field, LF or CRLF) and SQL.
- SQL for four dialects: PostgreSQL, MySQL / MariaDB, SQLite and SQL Server, with batching, an optional
CREATE TABLEand an optional transaction. - Clear validation messages: an unclosed quote with its line number, rows with too few or too many fields, empty or duplicate headers, and invalid JSON with its line and column.
How to Use the CSV to JSON and SQL Converter
- Paste CSV or JSON into the Input box, drop a
.csvor.jsonfile on it, or click Open file. The Sample CSV and Sample JSON buttons load test data. - Check the summary line under the input. It shows the detected format, delimiter, header row and table size.
- Pick an output tab (JSON, CSV or SQL INSERT) and adjust its options. For SQL, enter the table name, for example
public.customers. - Read any yellow or red messages. Red means the input could not be converted; yellow means the CSV to JSON and SQL converter fixed something and tells you what.
- Click Copy, or Download to save a
.json,.csvor.sqlfile.
How the SQL INSERT Output Is Built
The SQL tab of the CSV to JSON and SQL converter writes plain statements with the values inline, with no ? or $1 placeholders, so you can paste them into psql, the MySQL client, DB Browser for SQLite or SQL Server Management Studio as they are.
- Escaping per dialect: single quotes are doubled everywhere. MySQL also gets its backslashes escaped, and SQL Server gets an
N'...'prefix on strings with non-ASCII characters so they survive inNVARCHARcolumns. - Quoted identifiers: table and column names are wrapped in double quotes, backticks or square brackets to match the dialect, so headers like
First Nameororderwork. Switch to “only when needed” for bare names where they are safe. - Real NULLs and booleans: empty cells become
NULL, and booleans becomeTRUE/FALSEor1/0depending on what the dialect supports. - Batching: choose 1, 100, 500 or 1000 rows per
INSERT. SQL Server allows at most 1000 rows per statement, so the CSV to JSON and SQL converter splits larger batches for you. - CREATE TABLE: column types are inferred from the data, including
DATEandTIMESTAMPfor ISO dates andJSONBorJSONfor nested values.
Literal SQL is the right tool for one-off imports, seed data and fixtures from files you trust. Inside an application, keep using parameterized queries.
What It Deliberately Does Not Guess
Some conversions can’t be done safely without asking you, so the CSV to JSON and SQL converter keeps the original text:
- Decimal commas (
3,50) and thousands separators (1,000) stay text, because a wrong guess would change the value. - Dates stay as the strings you gave. They are only mapped to a date type in the
CREATE TABLEoutput. - A header that looks like data can fool the detection. The header setting always wins over the guess.
Practical Use Cases
- 📊 Spreadsheet to API: export a sheet as CSV and turn it into the JSON body a REST endpoint or a config file expects.
- 🗄️ Seed a homelab database: turn a CSV into
INSERTstatements for the MariaDB behind a self-hosted app, like the setup in running WordPress and MariaDB in Docker on OpenMediaVault. - 🔁 API response to spreadsheet: paste a JSON response and let the CSV to JSON and SQL converter write CSV with a BOM, so Excel shows accented text correctly.
- 🧪 Test fixtures: build SQLite or PostgreSQL fixtures from a small CSV, wrapped in a transaction.
- 🧹 Fix a broken export: the validation messages point to the exact line with an unclosed quote or a missing field. For config formats rather than tables, use the YAML JSON TOML converter, and check a single payload with the JSON formatter and validator.
Privacy, Ads, and Data Policy
Spreadsheets and database exports often hold customer names, emails and prices, so the CSV to JSON and SQL converter keeps all of it on your device:
- ✅ 100% free: no registration, no account, no paywalled features
- ✅ No data storage: your data is never uploaded, and it is not saved in cookies, local storage or the page URL
- ✅ No ads in results: no watermarks, banners or tracking links in your output
- ✅ Client-side only: no external libraries and no network requests; parsing and conversion happen in your browser
Open Source and Self-Hosting
The CSV to JSON and SQL converter is open source and lives in the vahac-tools repository on GitHub, next to every other tool on this site. It has no dependencies: one folder with an HTML, a CSS and a JavaScript file that you can host on any static web server, or keep in a self-hosted toolbox like the one in self-hosting IT-Tools in Docker on OpenMediaVault.
Forks and pull requests are welcome, whether that is a new SQL dialect or a smarter date check. Looking for more utilities like this CSV to JSON and SQL converter? Browse the full list on the Tools page.
Built by VahaC — 100% client-side, no data sent anywhere.
