SQL to JSON Converter

Paste INSERT statements or a database dump and get the rows as JSON, one object for each row.

Loading tool…

About the SQL to JSON

Every row of INSERT INTO … VALUES (…), (…) becomes a JSON object. The keys come from the column list of the statement. When there is none, as in most mysqldump files, they come from the CREATE TABLE of that table earlier in the script, and without one the columns are named col1, col2… One table gives an array; several tables give an object with one array for each table name (the schema prefix is left out). Comments (--, /* */, #) and all other statements are skipped.

The dialects differ in how they quote, and the tool detects which one the script uses. Identifiers can be written as `name` (MySQL), "name" (standard SQL) or [name] (SQL Server). In strings, '' is always a quote; a backslash is an escape (\', \n) in MySQL only, and in PostgreSQL inside E'…'. N'…' strings, $$…$$ strings and casts such as '2026-01-15'::date are read as plain strings. Choose the dialect yourself when a string like 'C:\' is read wrongly.

Values: NULL becomes null, TRUE and FALSE booleans, numbers become JSON numbers, and integers too large for a JSON number stay strings so that no digit is lost. Hex literals (0x1F, X'1F') are kept as text or converted to numbers. Function calls and expressions such as NOW() cannot be evaluated without a database, so they are kept as strings. A row with the wrong number of values, an unclosed string or a missing parenthesis is reported with its line number.

How to use it

  1. Paste INSERT statements or open a .sql file.
  2. Check the detected dialect in the status, or choose it.
  3. Choose the shape of the output and the indentation.
  4. Copy the JSON or download data.json.

Frequently asked questions

Where do the keys come from when INSERT has no column list?
From the CREATE TABLE statement of the same table, if it comes earlier in the script. Without it the columns are named col1, col2 and so on; add a column list to the INSERT to name them.
Does it run my SQL?
No. The statements are only read, in your browser. Nothing is executed or uploaded, so functions such as NOW() or UUID() stay as text.
Are dates converted?
SQL writes dates as strings ('2026-09-28 17:42:09'), and JSON has no date type, so they stay strings exactly as written.
Can it convert INSERT … SELECT?
No. Such a statement has no list of values; the rows exist only in the database. It is skipped, and the status says so.

Related tools