SQL to JSON
BetaTurn SQL INSERT statements into JSON in your browser. Reads mysqldump, SQLite and pg_dump --inserts dumps as text, keeps value types, and uploads nothing.
- Free, no sign-up
- REST + MCP
- Updated
- Reviewed by Olgun Ozoktas
Runs in your browser · no SQL is executed
SQL input
Options
Per column: a column with a zero-padded ID like '007' stays all strings
JSON output
nothing to convert yetJSON appears here
Each table becomes an array of row objects, keyed by column name.
Why Use Our SQL to JSON Converter?
A SQL dump is a text file of statements. The rows are already sitting in it as literal values, so turning them into JSON needs a parser rather than a database engine. This page walks the file character by character, tracking strings, quoted identifiers and comments, so a -- or a semicolon inside a value is data rather than the end of a statement.
Types are carried across rather than guessed. NULL becomes null and an unquoted TRUE or FALSE becomes a boolean. An unquoted number becomes a JSON number unless a double cannot hold it exactly — beyond ±9007199254740991 or more than 15 significant digits — in which case it is kept as a string, so a 64-bit ID is not silently rounded. Quoted values stay strings; with Coerce numbers on, a quoted value becomes a number only when it writes back as the same text, so a zero-padded code such as '007' or a price such as '1.50' keeps its exact form.
What the page will not do is evaluate anything. NOW(), DEFAULT and CURRENT_TIMESTAMP are kept as their SQL text and flagged under the panel. Hex and bit literals stay as text. An INSERT … SELECT has no literal rows in the file, so it is listed by line number rather than guessed at.
If you want a spreadsheet instead, SQL to CSV reads the same statements with the same parser. Going the other way, JSON to SQL turns JSON back into INSERT statements.
How it compares
The usual route from a dump to JSON is to restore it: create a database, import the file, then run a query that builds JSON — SELECT … FOR JSON in SQL Server, json_agg in PostgreSQL, JSON_ARRAYAGG in MySQL. That gives you the database's own type rules and works for dumps of any size, but it needs the matching database installed and a restore that can fail on dialect differences. Reading the statements as text needs neither, at the cost of never evaluating functions or queries.
You could also chain two tools: SQL to CSV and then CSV to JSON. That works, but CSV has no types, so every value comes back a string, NULL turns into an empty cell, and the second step has to guess numbers back. Going straight from SQL keeps null, booleans and numbers as the dump wrote them. If you do need a CSV from the JSON later, JSON to CSV does that.
Many online converters upload the dump to a server. A database export is often the most sensitive file you handle, so this page parses it in your browser and never sends it anywhere.
SQL to JSON Tips
- Column names come from the INSERT column list first, then from a CREATE TABLE earlier in the same input, then from positions (column_1, column_2 …). Paste the CREATE TABLE above the INSERTs if the dump omits column lists.
- Coerce numbers decides per column. A quoted column becomes numbers only when every quoted value in it writes back as the same text, so '5' and '12' become 5 and 12, while a code column holding '007' stays all strings.
- MySQL stores booleans as TINYINT(1), so a dump writes 1 and 0. Those stay the numbers 1 and 0; only an unquoted TRUE or FALSE becomes a JSON boolean.
- Turn Group by table off to get one flat array across all tables, and add the __table field so each row still says where it came from.
- Click a line chip under a skipped statement or an error to jump to that line in the SQL.