SQL to JSON Converter
Turn the data in a SQL dump into JSON. Paste INSERT statements, with or without the CREATE TABLE definitions, and get arrays of objects with proper numbers, strings, booleans and nulls. The file is parsed in your browser and never uploaded.
- Runs in your browser
- No sign-up
- Free to use
How to use SQL to JSON
- Paste SQL or open a .sql file that contains INSERT statements.
- Choose the output shape and indentation.
- Select Convert to JSON.
- Copy the JSON or download it as a file.
SQL to JSON features
Real SQL parsing
A tokenizer reads strings, escapes, comments and quoted names properly, so commas and brackets inside values are not a problem.
Column names from the schema
Uses the column list of the INSERT, or the CREATE TABLE statement when the INSERT has none.
Types preserved
Numbers become JSON numbers, NULL becomes null, TRUE and FALSE become booleans, strings are unescaped.
Multi-row and multi-table
Handles INSERT … VALUES (…), (…), (…) and dumps with many tables.
Embedded JSON
Optionally parses JSON stored in text columns into nested objects.
MySQL, PostgreSQL, SQLite, SQL Server
Understands backticks, double quotes, square brackets, doubled quotes and backslash escapes.
When to use SQL to JSON
- Turning a database export into fixtures or seed data for an application.
- Loading rows from a dump into a script or a spreadsheet tool that reads JSON.
- Inspecting what a .sql backup actually contains.
- Moving a small table to a document store or an API.
SQL to JSON FAQ
Which SQL statements are converted?
INSERT INTO … VALUES and REPLACE INTO … VALUES, including multi-row forms. CREATE TABLE statements are read for their column names. Everything else in the file, such as SET, DROP, ALTER or SELECT, is skipped.
What if my INSERT has no column list?
If the input also contains the CREATE TABLE statement for that table, its columns are used in order. Otherwise the fields are named column1, column2 and so on, and the status line tells you. Most dump tools can include column names, for example mysqldump --complete-insert.
Can it run a SELECT and return the result as JSON?
No. That needs a database, and this tool has none: it works only on the text you paste. To get query results as JSON, use your database's own functions, such as JSON_ARRAYAGG in MySQL, json_agg in PostgreSQL or FOR JSON in SQL Server.
What happens to values like NOW() or UUID()?
They are expressions that only the database can evaluate. They are kept as text exactly as written, and the status line counts them so you can replace them.
How are dates and booleans handled?
Dates are quoted strings in SQL and stay strings in JSON, which has no date type. TRUE and FALSE become JSON booleans. MySQL tinyint columns hold 0 and 1, and remain numbers, since the dump does not say which columns are meant as booleans.
Is there a size limit?
Up to 20 MB and 200,000 rows, limited by browser memory. Larger dumps should be split, or converted with a script.
Reading data out of a SQL dump
A SQL dump is a program: a list of statements that, when run, recreate a database. The data lives in INSERT statements, each naming a table and listing rows of values in brackets. To get the data without a database, those statements have to be read the way a database would read them, and that is less trivial than it looks.
The obstacles are in the values. A text value may contain commas, brackets, semicolons and even the word VALUES. Quotes inside a string are written doubled, as in 'O''Brien', or with a backslash in MySQL. Comments can appear anywhere. A converter that splits on commas fails on the first address field. This tool tokenizes the input first, recognising each string, number, name and comment as a unit, and only then interprets the structure. Line numbers in error messages point to the statement that could not be read.
Types carry over where SQL makes them visible. An unquoted 42 is a number, a quoted '42' is text, NULL is null. JSON has no type for dates or binary data, so those remain strings. Very large integers are a special case: JSON numbers in JavaScript are precise only up to 2^53, and identifiers beyond that, such as 64-bit snowflake IDs, are kept as strings to avoid silent corruption.
Column names matter for a useful result. The compact INSERT form without a column list relies on the table definition for the order of fields. If your dump includes CREATE TABLE statements, the converter takes the names from there. If not, export again with column names included, or paste the table definition above the inserts.