SQL to JSON Converter
Paste one or more SQL INSERT statements and get back the rows as a JSON array — with column names as keys and proper type detection for strings, numbers, NULL, and booleans.
Last updated: May 27, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is SQL to JSON Converter?
Database fixtures and export files often live as raw `INSERT INTO` statements — but downstream tools usually want JSON. Manually converting a multi-row insert is tedious and error-prone, especially with escaped strings and NULL values mixed in.
This converter parses INSERT statements like a real SQL tokenizer: it understands the three identifier-quoting styles (backticks for MySQL, double quotes for PostgreSQL, brackets for SQL Server), single- and double-quoted strings with both backslash and doubled-quote escaping, comments, and the NULL/TRUE/FALSE keywords. The result is a clean JSON array, one object per row, with the column names from the `INSERT INTO ... (...)` clause as keys.
How to Use SQL to JSON Converter
Paste one or more SQL INSERT statements.
Toggle pretty printing and indent.
Optionally wrap the output as { tableName: [...] } if you want to preserve the table name.
Copy the JSON output.
Common Use Cases
- Converting a database dump (.sql) into JSON fixtures for a test suite.
- Extracting tabular data from a SQL export for use in a JavaScript app.
- Migrating from a SQL-based fixture format to a JSON one.
- Debugging an INSERT by viewing the rows as parsed JSON.
Example Input and Output
A multi-row INSERT becomes a JSON array of objects.
INSERT INTO users (id, name, active) VALUES (1, 'Alice', TRUE), (2, 'Bob', FALSE);[
{ "id": 1, "name": "Alice", "active": true },
{ "id": 2, "name": "Bob", "active": false }
]Privacy
All parsing happens in your browser. No SQL is sent to a server.
Number precision
Numbers larger than 2^53 lose precision in JavaScript. For BIGINT values, wrap them in quotes in the SQL (or post-process) to keep them as strings.
Frequently Asked Questions
Which SQL dialects are supported?
The parser handles all the major identifier-quoting and string-escaping styles: MySQL backticks, PostgreSQL/standard double quotes, SQL Server brackets, single-quoted strings with both backslash and doubled-quote escapes. Pure SELECT or DDL is not parsed — INSERT only.
What if my INSERT has no column list?
The tool defaults to col1, col2, col3, ... in column order. Add an explicit column list to your INSERT for meaningful key names.
How are NULL, TRUE, FALSE represented?
NULL becomes JSON null, TRUE becomes true, FALSE becomes false. Quoted "NULL" stays a string.
Does this send my SQL anywhere?
No. All parsing happens locally in your browser.
Related Tools
SQL to CSV Converter
Parse SQL INSERT statements and produce a CSV table. Supports comma, semicolon, pipe, and tab delimiters with proper RFC 4180 quoting.
SQL to HTML Converter
Parse SQL INSERT statements and render them as an HTML table — with the table name as a caption, configurable CSS class, and optional inline styles.
SQL to XML Converter
Parse SQL INSERT statements and serialize them as XML — configurable root and row element names, NULL handled as xsi:nil, indented output, and optional XML declaration.
SQL Formatter
Format, minify, convert, compare, and analyze SQL queries in a private browser-based SQL formatter with MySQL and PostgreSQL workflow tools.
JSON Formatter
Format, validate, and beautify JSON instantly — with clear error messages, Tree View, Diff mode, and Schema validation.
CSV to SQL Converter
Convert CSV data into SQL INSERT statements for MySQL, PostgreSQL, SQLite, or SQL Server with optional CREATE TABLE output.

