How to convert SQL to JSON
A SQL dump stores data as INSERT statements. To convert SQL to JSON, the tool reads each INSERT INTO table (columns) VALUES (...) statement, turns every row into an object that uses the column names as keys, and collects the rows by table. NULL becomes null, numbers stay numbers and text stays text.
INSERT INTO items (id, label) VALUES (1, 'ok'), (3, 'three');
[
{ "id": 1, "label": "ok" },
{ "id": 3, "label": "three" }
]Dumps often contain user data, so the file is read in your browser and never uploaded, as the Privacy Policy describes. The tool reads statements. It does not run them, and it has no database engine.
Dumps with many tables and no column list
A real dump holds many tables. Each table that has rows gets its own entry, and with more than one table the output is an object keyed by table name. Pick one table in the Table box to export only that one.
mysqldump writes INSERT INTO users VALUES (1,'Ana',1), with no column names. The tool takes the names from the CREATE TABLE statement that came earlier in the same text. If there is none, the columns are called col1, col2 and so on, and a note says so. Schema-qualified names such as public.users and quoted names in backticks, double quotes or square brackets are read.
Statements that carry no rows, such as SET, LOCK TABLES, DROP, ALTER, CREATE INDEX and transaction commands, are skipped. The panel groups them by kind with the line of the first one, so you can see that nothing was missed silently.
Quotes, escapes and literals
Strings can be written in several ways and all of them are read: a doubled quote as in 'it''s', a backslash escape as in 'it\'s', and the \n, \t and \\ sequences. Backslash in strings has three settings. Auto, the default, reads backslashes as MySQL does, unless the text came from this site's JSON to SQL tool for another database. Escape reads backslashes as MySQL does. Plain reads them as normal characters, as standard SQL and PostgreSQL do.
- N'...' and E'...' strings, and MySQL character set introducers such as _utf8mb4'...'.
- Hex literals X'4142' and 0xBEEF, written as text such as 0x4142.
- Typed literals such as DATE '2026-01-02' and casts such as 'x'::text or CAST('5' AS INT).
- TRUE, FALSE and NULL, negative and exponent numbers, and comments in any position.
An expression the tool cannot evaluate, such as NOW() or UUID(), is kept as text and noted, because there is no database to run it. DEFAULT is read as null and noted.
Booleans, JSON columns and large numbers
MySQL stores true and false as tinyint(1). With the CREATE TABLE statement in the input, the option Read TINYINT(1) and BOOLEAN as true and false turns 1 and 0 in those columns into true and false. Columns declared as tinyint(4) or int are left as numbers. Without the CREATE TABLE statement the tool cannot know the type, so values stay as they are.
Columns declared json or jsonb hold JSON as text. Parse JSON columns turns the text into real JSON values, and a value that is not valid JSON stays a string with a note. Integers larger than 9,007,199,254,740,991 cannot be stored exactly as JSON numbers in JavaScript, so by default they are written as strings. Turn off Keep large numbers exact to get numbers.
[
{ "id": 1, "name": "Ana O'Neil", "active": true, "balance": 120.5, "prefs": { "theme": "dark" } },
{ "id": 2, "name": "Ben", "active": false, "balance": null, "prefs": null }
]PostgreSQL dumps with COPY
pg_dump writes table data as COPY table (columns) FROM stdin followed by tab-separated lines and a line with a backslash and a dot. The tool reads those blocks. \N is null, and \t, \n and \\ are decoded. With the CREATE TABLE statement present, boolean values t and f become true and false, numeric columns become numbers and jsonb columns are parsed.
A row with a different number of values than the column list is skipped and reported with its line, so one damaged row does not stop the rest.
Output shapes
- Array of objects: one object per row, or an object keyed by table when there are several tables.
- Keyed by table: always an object with the table names as keys.
- JSON Lines: one row per line, which suits large data. With several tables each line gets a _table key.
- Arrays of arrays: a header row of column names, then the values.
The JSON can be indented with 2 or 4 spaces or a tab, or minified. Download saves data.json, or data.jsonl for JSON Lines.
Limits and related tools
- Only INSERT ... VALUES and COPY data are read. INSERT ... SELECT, INSERT ... SET, UPDATE and DELETE need a database engine and are listed as skipped.
- The input can be up to 2 million characters, so a very large dump has to be split into parts.
- A string or quoted name that is never closed stops the conversion with the line number where it starts.
- It reads statements, it does not validate the SQL, so check the result against the source.
To go the other way, use JSON to SQL. JSONL Viewer is useful for looking through JSON Lines output, and JSON to YAML converts the result to YAML.