About this tool
Turn SQL data into JSON for tests, fixtures, mock APIs or a quick look in a JSON viewer. It reads two kinds of input:
- INSERT statements, as written by
mysqldump,pg_dump --inserts, SQLite’s.dumpor any SQL client’s “copy as INSERT”. Multi-rowVALUES (…), (…), quoted identifiers,''and backslash escapes,NULL,TRUE/FALSEand negative numbers are understood. If the INSERTs don’t list columns, column names are taken from aCREATE TABLEstatement in the input. - Query results: the boxed tables printed by the
mysqlclient,psqloutput, Markdown tables, and tab-separated rows copied from a grid in DBeaver, DataGrip, pgAdmin or MySQL Workbench. The first row is the header.
One table gives a JSON array of row objects; several tables give an object with one array per table. Values that aren’t plain literals, such as NOW(), are kept as text. Long integer IDs stay strings in result tables so no digits are lost.
To go the other way, the JSON to SQL converter writes CREATE TABLE and INSERT statements. Nothing is uploaded; this tool never connects to a database.
FAQ
How do I convert SQL INSERT statements to JSON?
Paste them above. Each row becomes a JSON object with the column names as keys.
Can I convert the output of a SQL query?
Yes. Paste the table printed by mysql or psql, or rows copied from your SQL client (tab-separated). The first row is used as column names.
What if my INSERT has no column list?
Include the CREATE TABLE statement and its column names are used. Otherwise the keys are column1, column2 and so on.
Does it connect to my database?
No. It only reads the text you paste, in your browser.