JSON to SQL
Paste a JSON array of objects and get CREATE TABLE plus INSERT statements for PostgreSQL, MySQL or SQLite. Booleans stay booleans, null becomes NULL, nested objects become JSON text. Runs in your browser.
- Free, no sign-up
- REST + MCP
- Updated
- Reviewed by Olgun Ozoktas
SQL statements will appear here..
Why Use Our JSON to SQL Converter?
The interesting part of converting JSON to SQL is not the syntax, it is the types. JSON has real booleans, real numbers and a real null; CSV has none of those, only text. That difference is why the JSON to CSV to SQL route quietly damages data, and why this page exists as its own tool rather than a link to the other two.
Each column is decided by the values actually present across every row. Integers stay integers; an integer column widens to a numeric one the moment a decimal appears; a boolean beside a number makes the column text, because no dialect stores both in one place. Nulls and missing keys are ignored while deciding, so they can never narrow a column to text.
The dialect choice changes two things and only two things. Identifier quoting: double quotes for PostgreSQL and SQLite, backticks for MySQL, with any quote character inside a name doubled so a hostile column name cannot break out. And the type names written into the CREATE TABLE — plus the booleans, since SQLite has no boolean literal and stores 1 and 0 instead.
Nested objects and arrays are written as JSON text rather than expanded into extra tables. That is a deliberate limit. Deciding that an array of objects should become a second table with a foreign key is schema design, and a converter that guessed at it would be wrong often enough to be worse than useless.
How it compares
Most online JSON to SQL tools post your JSON to a server. An API payload usually carries exactly the fields you would not want on somebody else's disk — email addresses, tokens, customer names. This page generates the SQL in your browser, so the JSON never leaves the tab.
The other common workaround is a two-step trip through JSON to CSV and then CSV to SQL. It works for a flat array of strings and numbers, and it is the wrong tool the moment a value is a boolean, a null or a nested object, because CSV cannot carry any of those as anything but text.
Going the other direction, SQL to CSV reads rows back out of a dump, and SQL Formatter pretty-prints the statements once you have them.
JSON to SQL Tips
- Keys are unioned across every row in first-seen order, so a row with an extra field widens the table instead of being clipped.
- A key missing from one row and a key explicitly set to null both become NULL — there is no way to tell them apart in SQL.
- A null never decides a column's type. A column of nulls and integers is an integer column.
- Nested objects and arrays are stored as JSON text in one column. Splitting them into related tables is a schema decision, not a conversion.
- Turn on multi-row INSERTs for a large array. Statements are chunked at 500 rows so no single statement becomes unmanageable.