Data & AnalyticsLive🔒 Private

SQL to JSON

Convert SQL CREATE/INSERT statements to JSON data. Free online SQL to JSON converter. No signup, 100% private, works in your browser.

How it works

The SQL to JSON converter reads a SQL INSERT statement dump and outputs the data as a JSON array of objects — or converts a CREATE TABLE statement into a JSON Schema. Use it to extract data from SQL dumps for use in APIs, JavaScript applications, or data migration workflows.

Database administrators export data as SQL INSERT dumps for backups and migrations. Developers building APIs, frontend apps, or data analysis workflows need the same data as JSON. Manually converting INSERT statements to JSON is tedious and error-prone for large exports. This tool automates the conversion.

How to use it: paste SQL INSERT statements or upload a .sql file. The tool parses the INSERT column list and VALUES tuples, matches them, and produces a JSON array where each tuple is an object. Download as .json.

Input format: INSERT INTO table_name (col1, col2) VALUES ('val1', 'val2'), ('val3', 'val4'); is converted to [{"col1":"val1","col2":"val2"},{"col1":"val3","col2":"val4"}].

Type inference: numeric values without quotes are output as JSON numbers. NULL is output as JSON null. TRUE/FALSE are output as JSON booleans. Date strings are preserved as strings.

CREATE TABLE to JSON Schema: paste a CREATE TABLE statement and enable Schema mode. The tool converts column definitions (VARCHAR(255) NOT NULL, INT DEFAULT 0, etc.) into a draft JSON Schema with correct types and constraints.

Privacy: SQL parsing runs in the browser.

Frequently Asked Questions

What SQL dialects are supported?
The parser handles standard SQL INSERT syntax compatible with MySQL, PostgreSQL, SQLite, SQL Server, and Oracle. It handles quoted identifiers (backtick for MySQL, double-quote for PostgreSQL/standard SQL, square brackets for SQL Server), various string quoting styles, and multi-row INSERT VALUES lists.
Can it handle INSERT statements without a column list?
Yes — INSERT INTO table VALUES ('a','b','c') without a column list is supported. The output columns are named col1, col2, col3... unless you specify column names manually in the settings.
What about NULL values and SQL functions in the VALUES?
NULL becomes JSON null. String literals, integers, and floats are parsed to their JSON equivalents. SQL function calls in VALUES (e.g., NOW(), CURRENT_TIMESTAMP) are preserved as string literals in the JSON output — they cannot be evaluated without a database engine.
Can it convert SELECT query results (not INSERT statements)?
Not directly — the tool parses INSERT statements. To convert SELECT results to JSON, run the query in your database client and export as CSV, then use the CSV-to-JSON tool. Alternatively, most databases support SELECT ... FOR JSON (SQL Server) or json_agg() (PostgreSQL) to produce JSON output directly.