What does this tool do?
JSON to SQL converts an array of JSON objects into runnable SQL INSERT statements plus a matching CREATE TABLE statement. It's handy for developers and data analysts who want to load API data or exported records into a database quickly, and everything runs locally in your browser.
How to use it
- Paste or type your data into the left field.
- The result is generated instantly on the right.
- Use the Copy button to grab the output.
Schema and inserts together
The tool first builds a CREATE TABLE IF NOT EXISTS statement from the keys of the first object, then generates one INSERT INTO statement per row. Column types are inferred from sample values: whole numbers become INTEGER, decimals become FLOAT, booleans become BOOLEAN, and everything else becomes VARCHAR(255). Single quotes inside string values are safely escaped by doubling them, and null values are written as NULL so the output stays valid SQL.
Three database dialects
You can target MySQL, PostgreSQL, or SQLite. The identifier quoting changes with your choice: PostgreSQL uses double quotes, while MySQL and SQLite use backticks. You can also set the table name yourself, so the generated schema and INSERT statements drop straight into your target database. Boolean values are written as 1 and 0 for broad compatibility across engines.
Frequently asked questions
Why does the input have to be a JSON array?
The tool treats each array element as one table row, so you should paste an array of objects wrapped in square brackets rather than a single object; otherwise you'll see an 'array expected' error.
How are column types decided?
For each column, the first non-null sample value is inspected: numbers become INTEGER or FLOAT, booleans become BOOLEAN, and everything else becomes VARCHAR(255).
Will single quotes in text break the SQL?
No. Single quotes inside string values are automatically escaped by doubling them (''), so the generated INSERT statements stay valid.
Is JSON to SQL free?
Yes. JSON to SQL and all 300+ tools on MagmaNex are completely free with no signup or account required.
Is my data safe?
Yes. Everything runs locally in your browser. The data you enter is never sent to a server, stored, or shared.
Does it work on mobile?
Yes. JSON to SQL works on phones, tablets and desktops — no app download needed.
🔒 Privacy: everything runs in your browser, your data is never sent to a server.
