DevToolsmith

SQL to JSON

Extract JSON records from SQL INSERT statements without opening a database. Quoted values, multiple rows and multiple tables are supported, and large IDs and decimals stay exactly as written.

Runs 100% in your browser — nothing is uploaded

SQL INSERT statements
Tip: drop a file here209 chars · 209 bytes · 4 lines
JSON
276 chars · 276 bytes · 20 lines

3 rows · 4 columns in users. Literal VALUES only; SQL is never executed.

From an INSERT statement to JSON records

The column list supplies property names; each VALUES tuple supplies one object. SQL NULL becomes JSON null, SQL booleans become JSON booleans, and quoted strings remain strings. Dates are kept as text because JSON has no native date type.

Input
INSERT INTO accounts (id, name, balance) VALUES
(9007199254740993, 'O''Brien', 19.90),
(2, 'Grace', NULL);
Output
[
  {"id": 9007199254740993, "name": "O'Brien", "balance": 19.90},
  {"id": 2, "name": "Grace", "balance": null}
]

Choose the string escaping rules

In standard SQL and PostgreSQL ordinary strings, a backslash is a literal backslash. MySQL commonly uses backslash escapes such as \n; choose the MySQL dialect to decode them. PostgreSQL E-prefixed strings also decode supported backslash escapes. If your MySQL server uses NO_BACKSLASH_ESCAPES, select Standard SQL instead.

Prepare a larger database export

This converter expects INSERT statements with column names. It does not infer a schema from CREATE TABLE or evaluate SQL expressions. Export with explicit columns, remove setup/transaction statements, and split files above 10 MB or 100,000 rows. For mixed SQL dumps, a database’s native export is the more complete route.

To reverse the process, use JSON to SQL. For a spreadsheet export, use SQL to CSV, then create an Excel workbook.

Frequently asked questions

Does this connect to or run SQL against my database?

No. It reads literal INSERT statements as text in your browser. There is no SQL execution, database connection or upload.

Are large IDs and decimal values preserved?

Yes. Numbers are copied as exact JSON number literals, including integers beyond JavaScript’s safe range and decimal trailing zeros. The application that consumes the JSON must also handle those numbers correctly.

What SQL syntax is supported?

INSERT INTO with explicit column names and one or more VALUES tuples. Quoted identifiers, single-quoted strings with doubled quotes, numbers, NULL, booleans and date/time string literals are supported. Choose MySQL for backslash escapes. Expressions, functions, INSERT SELECT, conflict clauses and binary literals are rejected.

What if the input contains several tables?

Each table is kept separate. Choose a table from the selector; repeated INSERT statements for that table are combined. Rows keep only the fields present in their INSERT statement.