Skip to content
SQL INSERT → JSON or CSVDeveloper tools

SQL to JSON

Turn SQL INSERT statements from a database dump into JSON, one object per row, with column names from the INSERT or the CREATE TABLE. All tables at once, also CSV. No upload.

About this tool

About SQL to JSON

SQL to JSON reads the rows of SQL INSERT statements and turns them into JSON, so data from a database export can be used in a script, an API test, a JavaScript app or a spreadsheet without loading it into a database first. Paste the SQL or open a .sql file, for example a dump from mysqldump, phpMyAdmin, pg_dump with inserts, SQLite or SQL Server. The tool finds every INSERT INTO … VALUES statement, including those with many rows in one statement, and gives one JSON object per row. Column names come from the list in the INSERT, or, when the INSERT has none, from the CREATE TABLE of that table earlier in the file; without either, the columns are called column1, column2 and so on. Text keeps doubled quotes such as O’’Neil correctly, NULL becomes null, TRUE and FALSE become true and false, and numbers become JSON numbers unless you untick that option, which is useful for long IDs or phone numbers. MySQL dumps write a quote inside text with a backslash; PostgreSQL and SQL Server keep backslashes as they are, so you can switch backslash escapes off for those. Names in backquotes, double quotes or square brackets are read, and comments are skipped. If the file has several tables you can view them one at a time, or get one JSON object with every table by name. A table of the first rows shows the result, and you can copy the JSON, download it with 2 or 4 spaces or on one line, or save a table as CSV. Problems such as a row with too many values or an INSERT … SELECT, which cannot be read without the database, are listed. Everything runs in your browser; the SQL is never sent to a database or a server.

SQL to JSON tool

When SQL to JSON helps

Database rows where you need them

Test data

Rows from a dump for API tests.

Exampleusers.json for a mock server.

Seeding an app

Data for a JavaScript or Python script.

ExampleAll tables by name.

A spreadsheet

Rows from a dump in Excel.

ExampleSave as CSV.

Checking an export

See what a dump really holds.

ExampleThe first rows as a table.

Moving data

From MySQL to a NoSQL store.

ExampleOne object per row.

Documentation

Sample records for a guide.

ExampleIndent 2 spaces.

SQL to JSON tips

Clean JSON from any dump

Keep long IDs as text

Untick Numbers as numbers for IDs, phone numbers and codes with leading zeros.

PostgreSQL dumps

Untick Backslash escapes, so Windows paths and other text with backslashes stay as they are.

Export with INSERTs

pg_dump --inserts or --column-inserts writes rows as INSERT statements.

Need names?

Include the CREATE TABLE in the paste when the INSERTs have no column list.

Tidy the SQL first

Format long statements.

Open SQL Formatter

JSON to Excel

Open the result in Excel.

Open JSON to Excel
Built & tested by

HemantInsights

Senior Software Engineer · Developer of Toolyconvert

Hemant developed SQL to JSON and tests it on desktop and mobile with real files. He is a senior software engineer from Dehradun, India, building websites since 2014, and designed and developed Toolyconvert end to end.

Last updated 29 November 2026

Answers and guidanceFrequently Asked Questions
How do I convert SQL to JSON?
Paste the INSERT statements or open the .sql file. Each row becomes a JSON object; copy or download the result.
Where do the column names come from?
From the column list of the INSERT, or from the CREATE TABLE of that table in the same text. Without either, they are column1, column2 and so on.
Can it read a SELECT query?
No. A SELECT needs the database to run it. Run the query in your database and export the result, or export the table as INSERT statements.
Does it work with MySQL and PostgreSQL dumps?
Yes. For MySQL leave Backslash escapes on; for PostgreSQL and SQL Server switch it off.
What happens to NULL and TRUE?
NULL becomes null, TRUE and FALSE become true and false, and numbers become numbers unless you switch that off.
Can I get all tables at once?
Yes. Choose All tables by name to get one JSON object with an array for each table.
Is my data uploaded?
No. The SQL is read in your browser and never sent to a database or server.
More tools for your workflowRelated Tools

SQL Query Formatter

Format SQL as you type: one column per line, joins and conditions on their own lines, subqueries indented. Strings and comments never change.

CSV to JSON Converter

Convert CSV to JSON as you type. Comma, semicolon, tab or pipe, numbers and true/false, nested keys. Table preview, no upload.

JSON to Excel Converter

Turn JSON into a real Excel file. Nested objects become columns, several lists become sheets, and numbers, dates and IDs stay right.

JSON Formatter

Format, validate and minify JSON: 2 spaces, 4 spaces or tabs, sort keys, see the exact line and column of errors, fix trailing commas and quotes, copy or download.

1 / 3
Browse all developer tools

Featured on

Toolyconvert is listed on these product directories and launch platforms.